Which is more correct stop loss for opening buy position in mt4?
Which is more correct stop loss for opening buy position in mt4?
Loading saved threads...
QuantPilot · External communityPost link
External question — Stack Overflow Stack Exchange
Author: QuantPilot
Original post: https://stackoverflow.com/questions/77482757
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
so far, I did use this formula without question.
stoploss = NormalizeDouble(Ask - StopLossInPoint * Point, Digits);
But today's sudden price spike made me think about it again.
I guessed Ask price(XAUUSD, 2023.11.14 GMT+2 15:30) was unreasonably big at that moment.
Because my log message says that the stoploss(300point based) computed with above formula was even bigger than the chart-displayed price level(I hope it's Bid price what I see in chart), whereas it should be smaller than it.
Long Order Failed with error #130, which means invalid stop loss.
So I think the spread was approached 300 point, and failed to open position.
Can I use Bid for computing stop loss of buy position like this?
stoploss = NormalizeDouble(Bid - StopLossInPoint * Point, Digits);
What could using Bid make unexpected result?
some sites requires to use
Bid
.
https://www.earnforex.com/guides/ordersend-error-130/
I inspected open sources in github, and many of them is based on
Ask
.
Quote
Report
Dorian · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Dorian
Original post: https://stackoverflow.com/a/77486107
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
imho for BUY orders You should use
double sl = NormalizeDouble(symbolInfo.Bid() - StopLevel * point, (int)digits);
and for SELL orders You should use
double sl = NormalizeDouble(symbolInfo.Ask() + StopLevel * point, (int)digits);
-it is from my mql5 but it is almost the same in older
and the same thing is suggested on this website that You posted link to.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: QuantPilot Source score (net votes, not local likes): 1 Original post: https://stackoverflow.com/questions/77482757 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. so far, I did use this formula without question. stoploss = NormalizeDouble(Ask - StopLossInPoint * Point, Digits); But today's sudden price spike made me think about it again. I guessed Ask price(XAUUSD, 2023.11.14 GMT+2 15:30) was unreasonably big at that moment. Because my log message says that the stoploss(300point based) computed with above formula was even bigger than the chart-displayed price level(I hope it's Bid price what I see in chart), whereas it should be smaller than it. Long Order Failed with error #130, which means invalid stop loss. So I think the spread was approached 300 point, and failed to open position. Can I use Bid for computing stop loss of buy position like this? stoploss = NormalizeDouble(Bid - StopLossInPoint * Point, Digits); What could using Bid make unexpected result? some sites requires to use Bid . https://www.earnforex.com/guides/ordersend-error-130/ I inspected open sources in github, and many of them is based on Ask .
Checking account access…