Bool criteria not changing Program-No change in Backtest. My final Bool code wrong??

 

Where I am a little unsure here is under the Sell and Buy code. In other words the If(Condition1 && Condition2) goes to another If statement for my final requirement?? Seems like we would need and else in here.

JimTrader1

Files:
 
  1.    if(Volume[0]>1) return;
    Volume is unreliable, you can miss ticks. Bars is unreliable (max bars on chart) Always use time.
    static datetime time0; if (time0 == Time[0]) return; time0 = Time[0];

  2.  if(sto>80)Condition1=True;
    And when do you set it to false?
    Condition1= sto>80;

  3. You MUST count down when closing orders.
  4. Always test return codes
    if (!OrderClose(...))
       Alert("OrderClose failed: ", GetLastError());
  5. res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue);
    :
     OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
    EA's must adjust for 4/5 digit brokers, TP, SL, AND slippage
    //++++ These are adjusted for 5 digit brokers.
    int     pips2points;    // slippage  3 pips    3=points    30=points
    double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
         if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    //---- These are adjusted for 5 digit brokers.
        /* On ECN brokers you must open first and THEN set stops
        int ticket = OrderSend(...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else if (!OrderSelect(ticket, SELECT_BY_TICKET))
           Alert("OrderSelect failed: ", GetLastError());
        else if (!OrderModify(OrderTicket()...)
           Alert("OrderModify failed: ", GetLastError());
         */
    :
    res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3*pips3point,0,0,"",MAGICMA,0,Blue);
    :
     OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3*pips3point,White);
 
WHRoeder:
  1. Volume is unreliable, you can miss ticks. Bars is unreliable (max bars on chart) Always use time.
  2. And when do you set it to false?
  3. You MUST count down when closing orders.
  4. Always test return codes
  5. EA's must adjust for 4/5 digit brokers, TP, SL, AND slippage


Yes, I use MBTrading right now. The problem that I am having is, you can't have a StopLoss or TakeProfit in the same line as the Order. At least if it's

a Market Order. A limit or Stop Order will work.

Thanks,

JimTrader