// <インディケータ> // 共有メモリを読み込んで、データを表示する //------------------------------------- #import "shared_memory.dll" double set_a(); double write_a(double,int); double read_a(int); double close_a(); #import //------ #property indicator_separate_window #property indicator_buffers 2 //------ double PROFIT_C[]; double ZERO_LINE[]; double balance,profit,equity,spread,ASK_,BID_; double lots=1.0; int open_position; //-------------------------------------- int init() { set_a(); // SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Blue); SetIndexBuffer(0,PROFIT_C); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Black); SetIndexBuffer(1,ZERO_LINE); IndicatorBuffers(2); // profit=0.0; open_position=0; return(0); } //------------------------------------- int deinit() { close_a(); Comment(""); return(0); } //------------------------------------- int start() { //spread=Ask-Bid; spread=0.02; //for(int i=Bars-1000;i>=0;i--)//OK //for(int i=0;i<=Bars-1000;i++)//OK for(int i=1000;i>=0;i--)//OK { ZERO_LINE[i]=0.0; // if(open_position==0) { PROFIT_C[i]=0.0; // if(read_a(i)==+1.0) { ASK_=iClose(NULL,0,i)+spread; open_position=1; } else if(read_a(i)==-1.0) { BID_=iClose(NULL,0,i); open_position=-1; } } // if(open_position==1) { if(read_a(i)!=-1.0) { PROFIT_C[i]=(iClose(NULL,0,i)-ASK_)*10000; }else if(read_a(i)==-1.0) { // open_position=0; ASK_=0.0; } } // if(open_position==-1) { if(read_a(i)!=1.0) { PROFIT_C[i]=(BID_-(iClose(NULL,0,i)+spread))*10000; }else if(read_a(i)==1.0) { // open_position=0; BID_=0.0; } } // } // return(0); }