Tricky pending order deletion

 

Hi i`m trying to build an EA to trade candlestick patterns.The strategy would consist of 3 candlesticks.And after the second candlestick a buy-stop or sell-stop order would be placed above or below the 2 candle's wick,after the 2nd candle is formed but when the 3rd one is still forming.The problem would be when the 3rd bar closes, and if the pending order hasn't been activated yet, i need it deleted.

The problem is i don't know how to test at the 2nd candle, how to remove the pending order if at the 3rd candle's close it didn't activate.How to think 1 candle ahead?

 
Proximus:

Hi i`m trying to build an EA to trade candlestick patterns.The strategy would consist of 3 candlesticks.And after the second candlestick a buy-stop or sell-stop order would be placed above or below the 2 candle's wick,after the 2nd candle is formed but when the 3rd one is still forming.The problem would be when the 3rd bar closes, and if the pending order hasn't been activated yet, i need it deleted.

The problem is i don't know how to test at the 2nd candle, how to remove the pending order if at the 3rd candle's close it didn't activate.How to think 1 candle ahead?


find out how you can find the time a trade is placed

if you know how to do that then next step will be at what bar did that time happen

is it before time bar[x] you can delete

 
Proximus: how to remove the pending order if at the 3rd candle's close it didn't activate.How to think 1 candle ahead?

You don't think a candle ahead. Are you a mind reader?

if Time[0] > OrderOpenTime then the order was placed on a previous bar.

 
WHRoeder:

You don't think a candle ahead. Are you a mind reader?

if Time[0] > OrderOpenTime then the order was placed on a previous bar.


I`m a prophet.Interesting...So you say you can't test the next bar either give a specific price at which to close or count the time and if 3-4 bars have passed lets say in a 5 min timeframe thats 15 min, then delete it.

So i cant do things like gather information from the following bar like Close[-1] or Open[-1] which would be empty currently,but at the next bar will be counted as Close[0] or Open[0],like how it would pass normally from Close[2] and Open[2] to the next bar of Close[1] and Open[1] isnt it?

 
"The following bar like Close[-1]" is the future. IT DOESN'T EXIST.
Reason: