Delay trade until another condition is true

To add comments, please log in or register
Mad Gamer
61
Mad Gamer  

Hello

I have an expert advisor(ea just typing it as keyword) that has two ways to open trades

the first way is for example using moving averages and stochastic

if the price is under a 50 period simple moving average and a 10 period sma is under 20 period sma and under the stochastic has crossed down giving a sell signal while the previous conditions are true it opens a sell here is a code it may not compile but just to explain the conditions

if(Close[1]>ma period 50&&ma period 10< ma period20&&stochastic sell = true){
Open sell
}

the another way of entering this trade says

if the previous conditions are true but the 10 sma hasn't yet crossed under the 20 sma then delay the entry until the 10 cross below the 20 and the price hasn't crossed above the 50 sma

so is there is a way to do that?

a way that set condition to delay until another condition become true?


If the above details is confusion

I just need a way to delay a trade until another condition is true.


if there is no way to delay trade until another condition is met is there is a way that i can measure an indicator for ex bars?

I want to check if the indicator from the last sell signal did it generate an opposite signal or not?


Greg Pawlak
189
Greg Pawlak  
Hi, add and set condition " 10 sma hasn't yet crossed under the 20 sma then delay the entry until the 10 cross below the 20 and the price hasn't crossed above the 50 sma " to true. Regards Greg
Mad Gamer
61
Mad Gamer  
Greg Pawlak:
Hi, add and set condition "  10 sma hasn't yet crossed under the 20 sma then delay the entry until the 10 cross below the 20 and the price hasn't crossed above the 50 sma " to true. Regards Greg

Hi greg thanks for you answer

but i need something more than this 

i will explain with image

the candle inside the box crossed above the 50 sma so it's a long signal

but i have a condition that says if bars where above the 50 sma for a set numbers of candles(10 as example)a candle crossed above 50 sma after the number of bars we set and 10 sma didn't cross below 20 during this then i want to delay the trade untill the 20 and the 10 regenerate a buy singal

i hope that i made it simple to unerstand


William Roeder
19826
William Roeder  
Mad Gamer: I just need a way to delay a trade until another condition is true.

If your conditions are not met, do not open a trade. Return to the terminal, and wait for another tick.

Greg Pawlak
189
Greg Pawlak  
Hi, if you still want use delayed open trade by number of candle, maybe you can use combination of indicator as delayed trade. Regards Greg
To add comments, please log in or register