close trade when candle closes down
-
Can someone please help me. I have created an ea for renko and so far I have the opening logic is fine and the logic for closing a trade in profit is good too but I cant figure out how to get a trade that is not in profit to close under my logic. I have it working using a traditional stop loss but I feel it would be much better if it close in this way. I have attached a picture to make things easy

-
in case it is renko, use something as "virtual price value" to close it ...
this virtual price value you save into variable after new trade is opened and its value is:
Buy opened .... vpvBuy=ClosePrice from previous candle - renkoSizeInPriceFraction for Buy, or
Sell opened .... vpvSell=ClosePrice from previous candle + renkoSizeInPriceFraction for Sellafter this use condition block which compare:
if Buy exist ... CurrentPrice<=vpvBuy ... close Buy ... vpvBuy=0 (save to low value)
if Sell exist ... CurrentPrice>=vpvSell ... close Sell ... vpvSell=10000000 (save to big value) -
thank you for the response. looks like I have a project for the weekend. another question.
the EA I have already is working fine on Eur/Usd but wont place a trade on dax. any sugestions -
if it is offline chart, it can be some misunderstanding in timeframes ..
-
@miro1360
I have tried to figure out what I am supposed to do with this information but to be honest I have no clue. would it be possible for you to give me an example please -
"Once per bar"?
-
@fxDreema
That's got it. thank you so much. it was so simple in the end! once per bar-close losable trades with the filter of more than Xpips. I'm so grateful!!!