return the same Price in last order every time I lost order

 

Hello 


I'm a beginner in Programming.


need to return the same Price in last order every time I lost order


let's say my buy stop Price (1800) and my Stop lose (-10)


when I take lost the Buy Stop go to (1800).




The price open direct when I run EA No extern




my Code


** Sorry for my English :)


 

extern double BuyStopOne=10;
extern double BuyStopOneSL=10;
extern double BuyStopOneTP=40;
extern double Dist=10;



int start()
  {


   if(OrdersTotal()==0)

      int buyticet= OrderSend(Symbol(),OP_BUYSTOP,BuyStopOne,(Ask+(Dist*point)),5,(Ask-(BuyStopOneSL*pt)),(Ask+(Dist+BuyStopOneTP*point)),NULL,0,0,Green);
      
     


  };

//+------------------------------------------------------------------+
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
 
int buyticet= OrderSend(Symbol(),OP_BUYSTOP,BuyStopOne,(Ask+(Dist*point)),5,(Ask-(BuyStopOneSL*pt)),
  1. You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

    1. 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?

    2. 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

    3. 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).

  2. You are opening a BuyStop at ten (10).
    AMF606let's say my buy stop Price (1800)
 
William Roeder:
  1. You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

    1. 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?

    2. 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

    3. 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).

  2. You are opening a BuyStop at ten (10).
No one explained spreads to me, so I lost money when they were too large. It depends on what you trade and the trend.