You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Obviously you have the code running twice on the same chart.
It can't run twice in the tester. Account type is irrelevant.
Duplicate chart, code on each? VPS and you didn't disable it on your machine? Terminal running twice?
You buy at the Ask and sell at the Bid.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
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 at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
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 spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
Thanks for the pointers Willam. Apologies for taking long to respond. See responses for point No.2 below.
2.1. I asssume that by "specfied amount" you mean that this take profit value '(Ask+(1000*Point())' must be the same as this stop loss value '(Bid-(3000*Point())' ?
2.2. I have followed the link you provided to figure out how to add average spread to my sell positions. Math is not my strongest points so I struggled to follow the Power Mean calculations you have used. I have since developed the following code to deal with spread and its widening. Please let me know if there are better ways to calculate average spread and manage spread widening. See code below.