Hi All,
I have just started learning on how to code using meta editor and I am facing an issue as described below:
- For instance on an ideal sell trade;
Entry Price : 1.2220
Stop Loss (SAR VALUE) : 1.2240 "Entry Price +20 pips"
Ideal Take Profit Level: 1.2220 (EP) - 50pips (Stop Loss distance from EP times 2.5x) = 1.2170
However, my EA as it is now is getting back the same value as the Entry Price for the Stop loss level - 1.19874.
Here is the fraction of the code which I think I've screwed something up.
if (signal =="sell" && PositionsTotal()<1)
trade.Sell(0.10,NULL,Bid,(SARvalue),(Bid - (((SARvalue - Bid)*2.5)*_Point)),NULL);
Your advise is much appreciated. Thanks.
That. Annot be right, heckt it again
,(Bid - (((SARvalue - Bid)*2.5)*_Point))
That. Annot be right, heckt it again
,(Bid - (((SARvalue - Bid)*2.5)*_Point))
Hi Amando,
What do you mean by that?
Hi Amando,
What do you mean by that?
I dont know your sar value, but normally its a price, that price you cannot muliplie with points
Hi All,
I have just started learning on how to code using meta editor and I am facing an issue as described below:
- For instance on an ideal sell trade;
Entry Price : 1.2220
Stop Loss (SAR VALUE) : 1.2240 "Entry Price +20 pips"
Ideal Take Profit Level: 1.2220 (EP) - 50pips (Stop Loss distance from EP times 2.5x) = 1.2170
However, my EA as it is now is getting back the same value as the Entry Price for the Stop loss level - 1.19874.
Here is the fraction of the code which I think I've screwed something up.
if (signal =="sell" && PositionsTotal()<1)
trade.Sell(0.10,NULL,Bid,(SARvalue),(Bid - (((SARvalue - Bid)*2.5)*_Point)),NULL);
Your advise is much appreciated. Thanks.
if(Short==true&&SellOrders<1){ double SL=0;if(StopLoss==true&&SAR[1]>Bid){SL=SAR[1];} double TP=0;if(TakeProfit>0){TP=Bid-(SAR[1]-Bid)*TakeProfit;} // input double TakeProfit=2.5 if(!trade.PositionOpen(_Symbol,ORDER_TYPE_SELL,LotSize,Bid,SL,TP,CustomComment)){ Print("PositionOpen error ",trade.ResultRetcode()); return; } }
trade.Sell(0.10,NULL,Bid,(SARvalue),(Bid - (((SARvalue - Bid)*2.5)*_Point)),NULL);
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by 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 shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 pip spreads) in EURCHF? - General - MQL5 programming forum (2022)
- 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 have just started learning on how to code using meta editor and I am facing an issue as described below:
- For instance on an ideal sell trade;
Entry Price : 1.2220
Stop Loss (SAR VALUE) : 1.2240 "Entry Price +20 pips"
Ideal Take Profit Level: 1.2220 (EP) - 50pips (Stop Loss distance from EP times 2.5x) = 1.2170
However, my EA as it is now is getting back the same value as the Entry Price for the Stop loss level - 1.19874.
Here is the fraction of the code which I think I've screwed something up.
if (signal =="sell" && PositionsTotal()<1)
trade.Sell(0.10,NULL,Bid,(SARvalue),(Bid - (((SARvalue - Bid)*2.5)*_Point)),NULL);
Your advise is much appreciated. Thanks.