-
OrderSend(Symbol (),OP_BUY,LotSize,Ask,3,Ask - (StopLoss * Pips), Ask + (TakeProfit * Pips),
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
-
-
OrderModify( OrderTicket(), //For current order OrderOpenPrice(), // opened for the OpenPrice Ask + (TraillingStep * Pips), // set stop loss OrderTakeProfit(), // unchanged takeprofit 0, // no expiration CLR_NONE // no color );
How can the stop loss be above the market for a buy order?
-
Vous achetez à la demande et vous vendez à l' offre . Les ordres d'achat stop en attente deviennent des ordres de marché lorsqu'ils sont frappés et ouverts à la demande .
-
Le TP / SL de votre ordre d'achat (ou l'entrée de Sell Stop / Sell Limit) est déclenché lorsque le Bid / OrderClosePrice l' atteint. En utilisant Ask ± n , votre SL est plus court et votre TP plus long, par l'écart. Vous ne voulez pas que le montant spécifié soit utilisé dans les deux sens?
-
Le TP / SL de votre ordre de vente (ou l'entrée de Buy Stop / Buy Limit) sera déclenché lorsque le Ask / OrderClosePrice l' atteindra. Pour déclencher près d'un prix Bid spécifique , ajoutez le spread moyen.
MODE_SPREAD (Paul) - Forum de programmation MQL4 - Page 3 # 25 -
Les graphiques montrent uniquement les prix des offres . Activez la ligne Ask pour voir la taille du spread ( Outils → Options (contrôle + O) → graphiques → Afficher la ligne de demande .)
La plupart des courtiers avec des spreads variables s'élargissent considérablement en fin de journée (17 h HE) ± 30 minutes. Mon GBPJPY (OANDA) montre un spread moyen = 26 points, mais un spread maximum moyen = 134 (votre courtier sera similaire).
-
- Comment le stop loss peut -il être supérieur au marché pour un ordre d'achat?
Hi William Roeder :)
Woah, actually I had totally neglected the spread!
I will add it .. thank you very much for that (genius) ..
So indeed it may be an abuse of language but the
Ask + (TraillingStep * Pips), // définir la perte d'arrêt
Is not a StopLoss .. but a "condition" If the high of the candle is equal to my "TraillingStopStart" (ask + 80 pips) then I would like to trigger my trailing StopLoss directly at (ask + 70) so 10 pips below on current price then thereafter my TraillingStep is the movement of my StopLoss by 10 pips by 10 pips each time the market increases by 10 pips.
I had first created the code in a very simple EA with very simple order launch conditions, just to check the correct operation of my Trailling StopLoss .. Everything worked perfectly so I integrated my real strategy (therefore more complex) and bim .. Error 130 OrderModify
Your code | Documentation |
---|---|
OrderModify( OrderTicket(), //For current order OrderOpenPrice(), // opened for the OpenPrice Ask + (TraillingStep * Pips), // set stop loss OrderTakeProfit(), // unchanged takeprofit 0, // no expiration CLR_NONE // no color ); | bool OrderModify( int ticket, // ticket double price, // price double stoploss, // stop loss double takeprofit, // take profit datetime expiration, // expiration color arrow_color // color ); |
Hi, I'm Thomas a passionate beginner coder..
I have searched on a lot of topics but I did not find how to solve my problem .. maybe someone can enlighten me ..
Here is my code :
Everything works perfectly except the modification of the stop loss (the bold part)
The stop loss is supposed to move from the moment it reaches the purchase price + the Takeprofit (traillingstopstart)
thank you in advance for your help,
if ( HighestCandle <= Ask + (TraillingStopStart * Pips) && OrderStopLoss()!=Ask + (TraillingStep * Pips)){ OrderModify( OrderTicket(), //For current order OrderOpenPrice(), // opened for the OpenPrice Ask + (TraillingStep * Pips), // set stop loss OrderTakeProfit(), // unchanged takeprofit 0, // no expiration CLR_NONE // no color );
- 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, I'm Thomas a passionate beginner coder..
I have searched on a lot of topics but I did not find how to solve my problem .. maybe someone can enlighten me ..
Here is my code :
Everything works perfectly except the modification of the stop loss (the bold part)
The stop loss is supposed to move from the moment it reaches the purchase price + the Takeprofit (traillingstopstart)
thank you in advance for your help,