- Alessandro Furlani: e but it seems not work properly
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problemWe can't see your broken code.
Always post all relevant code (using Code button) or attach the source file.
- Alessandro Furlani: i want to build an EA with a sort of "ghost" TP and SL.
Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.
-
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problemWe can't see your broken code.
Always post all relevant code (using Code button) or attach the source file.
-
Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.
I think you haven't understood or i was not able to explain my question. What i'm asking is which is the best variable to compare with my threshold to have TP and SL managed by code. I'm doing this question because i tried various variables that contain the price (like Ask, Bid, High, Low, etc...) but the behavior is always different (in back test) compared with the TP and SL managed by MT4. In a few words, when i use the TP and SL managed by MT4 the trading are closed well at the setup of the TP and SL, when i tried to simulate this checking the price the result is not always the same, using the same MT4 with the same database. In other words which price the MT4 use to trigger the TP and SL price ? I would use the same in my code.
That's the simply question.
I think you haven't understood or i was not able to explain my question. What i'm asking is which is the best variable to compare with my threshold to have TP and SL managed by code. I'm doing this question because i tried various variables that contain the price (like Ask, Bid, High, Low, etc...) but the behavior is always different (in back test) compared with the TP and SL managed by MT4. In a few words, when i use the TP and SL managed by MT4 the trading are closed well at the setup of the TP and SL, when i tried to simulate this checking the price the result is not always the same, using the same MT4 with the same database. In other words which price the MT4 use to trigger the TP and SL price ? I would use the same in my code.
That's the simply question.
For virtual/stealth/ghost stops (S/L and T/P), of any open order, all you need to monitor is ... OrderClosePrice for the selected ticket.
This function returns the close price of the currently selected order, which will be the current Bid price for open Buy orders and the current Ask price for open sell orders.
- docs.mql4.com
For virtual/stealth/ghost stops (S/L and T/P), of any open order, all you need to monitor is ... OrderClosePrice for the selected ticket.
This function rreturns the close price of the currently selected order, which will be the current Bid price for open Buy orders and the current Ask price for open sell orders.
Thank you for the suggestion, i already do it. My problem is that the same EA working with TP and SL managed by MT4 or with TP and SL managed by code give me different result.
My problem is that, with ghost TP and SL i'm not able to intercept some price variation.
For TP on long orders i tried with:
- iHigh(NULL, 0,0)>=PriceTP
- Ask>= PriceTp
- High[0]>=PriceTP
but no one of them closed all the TP, some are closed some other not. On the contrary when the TP(at the same level of PriceTP) is managed by MT4 the closure of TP is always done, perfectly.
Same situation with StopLoss.
That's why my question, what i'm wrong ? Maybe is test environment ? But my thoughts are: if the MT4 TP and SL works fine also in test environment i should be able to do the same.
For sure i'm doing something wrong, but what ?
Thank you for your suggestion
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, i want to build an EA with a sort of "ghost" TP and SL. Which price you suggest to use to be the trigger of the closure of the trade ?
I have already tested with Ask to close short trade, Bid to close long trade but it seems not work properly sometimes the price is triggered sometimes not.
What you suggest ?