How do I store the last BUY or SELL that occurred in a variable?
-
How do I store the last BUY or SELL that occurred in a variable?
-
@khalids222

How can I determine a fixed point on the chart? Or determine the last sell or buy made? And put it in a variable? Or just select it -
@khalids222 Do you mean you need the value of the open price of the last trade? Or the close price?
-
@l-andorrà
open price.
The value of the recent open buy or sell -
@khalids222 Then try this:

-
@l-andorrà Thank you. We missed you, our return for your presence and your responses.
we Hope you had a happy vacationI'm sharing the project, here
Also notice in the picture the condition is very simple
if CLOSE(0)> CLOSE (1) = BUY
CLOSE(0)< CLOSE (1) = SELLThe last transaction that is done according to these conditions, whether buying or selling, is the dividing line for the next process
-
perhaps because you are using candle ID 0 under the condition of the IF Trade block?
-
@khalids222 Both 'For each trade' blocks have an ID number lower than both 'If trade' blocks. This means those variables will never catch the open price AFTER the trade is open. They should have hight ID numbers than both 'if trade' blocks.
-
@l-andorrà said in How do I store the last BUY or SELL that occurred in a variable?:
@khalids222 Both 'For each trade' blocks have an ID number lower than both 'If trade' blocks. This means those variables will never catch the open price AFTER the trade is open. They should have hight ID numbers than both 'if trade' blocks.
oh damn, thank you!! That helped me with another EA of mine.
-
@l-andorrà Thank you, I'll try changing the id number to up
-
@jsauter86 Thank you, but this is not the reason
-
In that case I recommend you to dissect your project into smaller parts and check them one by one to work correctly. Then reconnect them again step by step until you find the reason.
