how to add indicator code into expertadvisor code ?? - page 6

 

Take a look . . . it compiles.

Files:
 
for(shift=Bars-1; shift>=0; shift--)
      {    // <<=== ad that ...
      double ZigZagHigh=iCustom(NULL,0,"ZigZag",MODE_HIGH,0);
      double ZigZagLow=iCustom(NULL,0,"ZigZag",MODE_LOW,0);
      double LowestBar=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
      double HighestBar=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)];
      double diClose0=iClose(NULL,5,0);
      double diMA1=iMA(NULL,5,5,0,MODE_EMA,PRICE_OPEN,1);
      double diClose2=iClose(NULL,5,0);
      double diMA3=iMA(NULL,5,4,0,MODE_EMA,PRICE_OPEN,1);
      double lowestbid=iLow(NULL,0,LowestBar);
      double highestbid=iHigh(NULL,0,HighestBar);
      }    // <<== add that too ...
We don't know the logic of this EA or how it works, so we can not tell whether this profitable or not.
 

ya, i knw...

so far i success added some command into it.

do this useful ??

what this for ??

} 
string GetCommentForOrder() { return(Name_Expert); } 

double GetSizeLot() { return(LotSize); } 
double GetTakeProfitBuy() { return(Ask+longTradeTP*Point); } 
double GetTakeProfitSell() { return(Bid-ShortTradeTP*Point); }
double GetStopLossBuy() { return(Bid-LongTradeStopLoss*Point); }
double GetStopLossSell() { return(Ask+ShortTradeStopLoss*Point); }
 
That's calculation for your extern input
 

wow ^^

so fast RaptorUK did it for me..

thanks..


 
albert_lim83:

ya, i knw...

so far i success added some command into it.

do this useful ??

what this for ??

You probably don't need all these functions . . . they are just passing globally declared variables than you can access directly . . . . so instead of . . .

ldLot = GetSizeLot(); 

you can use . . .

ldLot = LotSize;

and you don't even need that . . . you can simply do this . . .

OrderSend(Symbol(),OP_SELL,ldLot,Bid,Slippage,  LotSize   ,ldTake,lsComm,0,0); 
 
albert_lim83:

wow ^^

so fast RaptorUK did it for me..

thanks..


I didn't add the braces around the code after the for loop . . . you will need to add them if that is what you meant to do . . .
 
onewithzachy:
That's calculation for your extern input
mean we no need doing something for these ?
 
RaptorUK:

You probably don't need all these functions s . . .

Just the lot size, the take profit and stop loss must be calculated based on Ask or Bid price (on buy or sell)

:)

 
albert_lim83:
mean we no need doing something for these ?
Must have, actually !
Reason: