Indicator entry Delay Possible? Won't work , Boolean Needed?

 

Too overcome a tendancy of too high or too low of a price entry, I have been trying to install a Stochastics

and RSI Overbought and Oversold OpenOrder Delay. In other words, not a set number of bars or time after

the Original entry signal.ONLY Stochastics and RSI for final OPEN_BUY or OPEN_SELL.

I have been using a simple EA to test this with and it will not work. This is easy to determine by just

running the Visual Strategy test with a Stochastics and RSI overlay. It is clearly entering when they are High

in the case of Long and Short when they are low. Maybe ya can't do what I am trying to do here. If not does

this mean using Boolean will get around it?

JimTrader1

 
  1.       static datetime LastEntryDetectedSell; 
          int iBarSe = iBarShift(NULL,0, LastEntryDetectedSell); 
    
    This static HIDES the global variable of the same name - bad. Static is never initialized - bad. iBarSe will always be Bars-1
  2.       res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
          return;
    
    Always test return codes.

  3. You have a pips2dbl but you must adjust 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(){                                                 OptParameters();
         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(..., 0,0,...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else if (!OrderSelect(ticket, SELECT_BY_TICKET))
           Alert("OrderSelect failed: ", GetLastError());
        else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)
           Alert("OrderModify failed: ", GetLastError());
         */
    

  4.    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];

 
WHRoeder:
  1. This static HIDES the global variable of the same name - bad. Static is never initialized - bad. iBarSe will always be Bars-1
  2. Always test return codes.

  3. You have a pips2dbl but you must adjust TP, SL, AND slippage
  4. Volume is unreliable you can miss ticks. Bars is unreliable (max bars on chart) Always use time


Thanks, wish I had your knowledge on this.

JimTrader1

Reason: