Setting tp of trades as point instead of price

yomadestephens
61
hi there happy people, i want to be able to type in point numbers and not price number in an OBJ_EDIT to use to modify my active trades sl and tp, any help on the lines of code onhow to go about this?
William Roeder
26790
William Roeder  
yomadestephens: code onhow to go about this?

You already know the answer, or should.

TP is a price = closing price + SLpoints * _Point

yomadestephens
61
yomadestephens  
William Roeder #:

You already know the answer, or should.

TP is a price = closing price + SLpoints * _Point

i dont really understand ur response here, am kinda new to the mql5 athmosphere. please could you shed more light. i kinda updated my question to express what i really want to do.

Mikeel1987
28
Mikeel1987  

Are you trying to have user input that will generate on your screen to change sl and tp on active trades?  Do you have any of the code written yet that we could analyze.


I am thinking of simply taking that input in points as you want and then creating a code that will run in the back ground something like this:

double StopLoss = Ask - UserInput;

if (UserInput == True)

        {

                bool OrderModify(OderSelect(),OrderOpenPrice(),StopLoss,OrderTakeProfit(),0,CLR_NONE);

        }
William Roeder
26790
William Roeder  
Mikeel1987 #: Are you trying to have user input that …
double StopLoss = Ask - UserInput;

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 shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).