Delay entry code doesn't work - looks Ok ??

 

I have carefully put in the information of this Order Delay for entry. It is supposed to Delay the entry and then look for the Stochastics and RSI to be in an OverSold or OverBought zone.

This HAS to be seperate from the main signal code.The reason is the Main code is more of a momentum and higher entry and the Stochastics and RSI will only allow a retracement or pullback

for entry. If both are used in the same line for entry, there are No entrys or Orders made. A Delay of 5 minutes or so would work. It doesn't have to be an exact amount. Just need to seperate

the Stochastics and RSI from the main signal code. It can't be too large of a Delay or trades will start to be missed. The way the code is in the program right now, seems as though the program

just ignores it. This is clearly visible when you run the Visual backtest with a Stochastics and RSI indicator installed on the chart.

JimTrader1

Files:
 

I think you have a brace { } issue . . . for example . . .

    Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);
        if((delay1 == shift) && (sto<stoLV && rsi<rsiLV))      //   if this is true . . .
         
            // open now 
            buyBE=true;                                       //  this is executed . . .
    
// Check for BUY entry signal                                 //  all this happens regardless . . . 
          {  
           if(stopLoss > 0)
               realSL = Ask - stopLoss * Point;
           if(takeProfit > 0)
               realTP = Ask + takeProfit * Point;
           if(Lots>=maxTrades)                                //   if this is true . . .
           
              buyBE=false;                                    //  this is executed . . .
                 
           // Buy
           ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, slippage,0,0,         //  this happens regardless . . .  
                    nameEA, magicNumber,0,Green); 
 
RaptorUK:

I think you have a brace { } issue . . . for example . . .


Thanks Raptor. I think you might be on to the problem. The problem is when I change or add brackets I get errors. Do you know of or have you seen an example of one of these Delays working? I would like to see an actual example of one that works. I am willing to pay for it. I can't spend much more time on this. What about the Sleep function?

Think I could make it work with this?

JimTrader1

 
jimtrader1:

Thanks Raptor. I think you might be on to the problem. The problem is when I change or add brackets I get errors. Do you know of or have you seen an example of one of these Delays working? I would like to see an actual example of one that works. I am willing to pay for it. I can't spend much more time on this. What about the Sleep function?

Think I could make it work with this?

JimTrader1

The sleep function won't help you when using the Strategy Tester.

Show your code that gives you an error . . .

 
RaptorUK:

The sleep function won't help you when using the Strategy Tester.

Show your code that gives you an error . . .


I just solved the problem without the Delay. It was simple. Use a Limit Order. Creates a Delay automatically. Not exactly using the Stochastics or RSI but pretty close.

I have one question for you though. This is the first time I have ever used limit orders on an EA. I can't understand what is happening in regards to the Target or Stop loss amounts.

I have the 5 digit code for the ECN Broker in place. With this installed I should be able to use 6 for a 6 pip target instead of 60. Or 20 instead of 200 for a 20 pip stop.

I have a limit of ORDER_LIMIT - 2PIPS. (using externals like pips2 etc.) The profits are like $2.30 to over $4 or more using just 1 microlot. With the ECN code working and 6 as a target, I should get about .60 to .80. Since changing this EA to limit Orders it performs much better. My mind is like a spinning calculator trying

to figure out what is happening with these target and stops. No matter how well the EA performs I really need to understand the new world of limit orders in the

program.

JimTrader1

 

If you apply your 4/5 digit fix multiplier to the SL TP and Slippage they should be fine just as they are for market Orders . . . bear in mind SL & TP are prices . . . slippage is in pips (4 digit) or 10ths of a pip (5 digits).

In terms of the Entry SL & TP a Limit order works just the same as a Market order . . . the only difference is that a Market order is entered NOW at Bid/Ask (Sell/Buy) . . . there is no delay in a Limit order, a Limit order does not determine when (time) and Order is entered but it does determine where (price) an Order is entered.

If you need a delay then you should code a delay . . . using a Limit order to work around a problem is not the best way to tackle the problem, you will lean much more by fixing the problem.

 
RaptorUK:

If you apply your 4/5 digit fix multiplier to the SL TP and Slippage they should be fine just as they are for market Orders . . . bear in mind SL & TP are prices . . . slippage is in pips (4 digit) or 10ths of a pip (5 digits).

In terms of the Entry SL & TP a Limit order works just the same as a Market order . . . the only difference is that a Market order is entered NOW at Bid/Ask (Sell/Buy) . . . there is no delay in a Limit order, a Limit order does not determine when (time) and Order is entered but it does determine where (price) an Order is entered.

If you need a delay then you should code a delay . . . using a Limit order to work around a problem is not the best way to tackle the problem, you will lean much more by fixing the problem.


Ok, Got it. Yeah the Delay would be better and good to add to my learning curve.

JimTrader1

Reason: