How to calculate profit when distance is less than a pip ?

 

Hi, 

I asked this question a while ago but something seems missing. I'm building a simple system that trades on 5 minutes timeframe based on some rules (simple rules), and until here it seems okay.

But the biggest problem it's occurring is that this system sometimes enter trades and puts the stop loss less than a pip for example while trading EURUSD:

Entry Price: 1.13636

TAKE PROFIT: 1.13634

STOP LOSS: 1.13637

That means we have a distance of stop loss of  0.00001.

I have a demo account of 1000 EUR and while testing it in this example puts the trade of more than 1 LOT, when it touches the stop loss the monetary value it's -20 EUR (More than one percent of account) and when it touches TP the value is 3 EUR (LESS THAN TWO PERCENT OF ACCOUNT).

Is there any solution to that, or due to small ranges we can't calculate this right?


Regards and thank you for replies.

 
Growth Dude: I asked this question a while ago but something seems missing. I'm building a simple system that trades on 5 minutes timeframe based on some rules (simple rules), and until here it seems okay. But the biggest problem it's occurring is that this system sometimes enter trades and puts the stop loss less than a pip for example while trading EURUSD: Entry Price: 1.13636 TAKE PROFIT: 1.13634 STOP LOSS: 1.13637 That means we have a distance of stop loss of  0.00001. I have a demo account of 1000 EUR and while testing it in this example puts the trade of more than 1 LOT, when it touches the stop loss the monetary value it's -20 EUR (More than one percent of account) and when it touches TP the value is 3 EUR (LESS THAN TWO PERCENT OF ACCOUNT). Is there any solution to that, or due to small ranges we can't calculate this right? Regards and thank you for replies.

You have not shown (by code) how you are calculating your volume, so we can only speculate on whether you are doing it correctly or not.

With distances so small, even the slightest slippage will drastically impact your trade, not to mention that Spread and Commission costs will guarantee a losing trade 100% of the time. There is also the fact that many brokers place Stops Level limits which prevents you from placing Hard Broker Stops so close to the entry price.

Add rules to your EA to prevent an order from being placed if the stops are too small. In you testing simulate the effects of delays, slippage, extra spread and commission costs so that you can see how they impact your strategy.

 

Growth Dude:

Entry Price: 1.13636

TAKE PROFIT: 1.13634

STOP LOSS: 1.13637

That means we have a distance of stop loss of  0.00001.

  1. 0.00001 is not a PIP. PIP, Point, or Tick are all different in general.
              What is a TICK? - MQL4 programming forum (2014)

  2. This is impossible since the spread on EURUSD is more than a point. You sell at the Bid, your SL is relative to the Ask.

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

  3. Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin and leverage. No SL means you have infinite risk. Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.

    1. You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce, the stop goes below the support.

    2. AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/PIP but it takes account of the exchange rates of the pair vs. your account currency.)

    3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
                MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum (2017)
                Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
                Lot value calculation off by a factor of 100 - MQL5 programming forum (2019)

    4. You must normalize lots properly and check against min and max.

    5. You must also check FreeMargin to avoid stop out

    6. For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)

    Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.