why minimum Stop loss is different in different lot size?

 

Hello everybody.

i made an EA that one of functions is trailing stop.

when i work with fix lot size 0.01, every thing is ok.

but when i use floating lot size according equity, i get error 130 for sendorder() and modifyorder()!

my STOPLEVEL in 0.01Lot and 0.1Lot is 50 and Point is 0.01.

in this order:

CFD: Gold - Order: Buy - OpenPrice: 1525.78  - PriceNow: 1526.3 - LotSize: 0.01

i can change stoploss to OpenPrice.

but in this order:

CFD: Gold - Order: Buy - OpenPrice: 1525.78  - PriceNow: 1526.3 - LotSize: 0.1

i can't change stoploss to OpenPrice.

why this problem is exist?

Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Compilation Errors
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Compilation Errors
  • www.mql5.com
Constants, Enumerations and Structures / Codes of Errors and Warnings / Compilation Errors - Reference on algorithmic/automated trading language for MetaTrader 5
 
You posted no code. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.

We can't see your broken code — we can only guess:

  1. Stop must be a valid price. Gold's tick size ≠ point. SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum

  2. You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP would be longer. Don't you want the same/specified amount for either direction?
    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To trigger at 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.)
 

Thank you for reply.

i found my problem!

i made a mistake in calculate profit!

i calculated profit according 0.01lot fix and change stoploss according floating lot size like 0.1 lot!

now i calculate profit according floating lot size and problem solved!

William Roeder:
You posted no code. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.

We can't see your broken code — we can only guess:

  1. Stop must be a valid price. Gold's tick size ≠ point. SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum

  2. You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP would be longer. Don't you want the same/specified amount for either direction?
    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To trigger at 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.)
Reason: