deVries, if you stopped your rant long enough to explain WHY the code I started with is so 'bad' I might understand what I can do to fix it. Read your response again, and then explain how your answer could help anyone.
Thank you, RaptorUK, finally an answer I can use.
To help explain, I only want this EA to run one one pair, one trade at a time. As I said earlier '... and placed one on each of 5 different pair charts, all on the same MT4 platform...' giving 5 separate (?) charts with that EA on them. At this stage I don't want or need to check Magic Numbers, do I ?
Re the comment on bars, thank you.
Re the slippage, 4/5 brokers etc, at this stage that doesn't matter, does it ? I'm using this for myself, on the same broker etc.
Sorry, somehow I missed the other answers, so I apologise for the 'rant' comment. and thank you for the actual assistance.
And I have tested it, and it works fine, no errors, no warnings. So why doesn't it work on a live chart ? (I haven't implemented the suggestions above yet)
1. At this stage I don't want or need to check Magic Numbers, do I ?
2. Re the slippage, 4/5 brokers etc, at this stage that doesn't matter, does it ? I'm using this for myself, on the same broker etc.
1. If you are never going to place a manual trade on any of the same pairs . . . then you can work without Magic Numbers . . . if you forget and happen to place a manual trade on one of the pairs that you have this EA running on then the EA will manage your manual trade too . . . if you code it properly then this won't be an issue.
2. It doesn't matter . . as long as you always remember to set the extern parameters correctly . . for example, the code you posted has a Slippage of 3 . . . on a 5 digit Broker this will equate to 0.3 pip slippage . . . if you code it properly then 3 will always mean 3 pips on both a 4 or 5 digit Broker and then you will have less scope for errors. Not coding it correctly is a short cut that will probably cost you time in the long run . . .
And I have tested it, and it works fine, no errors, no warnings. So why doesn't it work on a live chart ? (I haven't implemented the suggestions above yet)
You tested it where ? in the Strategy Tester ? where did you look for the errors ?
Ran it just now on audnzd from 17/05 to 22/05, and it opened 3 trades, 2 buys that were stopped out, and one sell that was closed at the end of the test.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Re the slippage, 4/5 brokers etc, at this stage that doesn't matter, does it ? I'm using this for myself, on the same broker etc.
1. At this stage I don't want or need to check Magic Numbers, do I ?
2. Re the slippage, 4/5 brokers etc, at this stage that doesn't matter, does it ? I'm using this for myself, on the same broker etc.
1. If you are never going to place a manual trade on any of the same pairs . . . then you can work without Magic Numbers . . . if you forget and happen to place a manual trade on one of the pairs that you have this EA running on then the EA will manage your manual trade too . . . if you code it properly then this won't be an issue.
2. It doesn't matter . . as long as you always remember to set the extern parameters correctly . . for example, the code you posted has a Slippage of 3 . . . on a 5 digit Broker this will equate to 0.3 pip slippage . . . if you code it properly then 3 will always mean 3 pips on both a 4 or 5 digit Broker and then you will have less scope for errors. Not coding it correctly is a short cut that will probably cost you time in the long run . . .
Al right here's mine :
Get discipline with coding, first parameter of iCustom is <string Symbol>, use Symbol() or NULL instead of zero.
MetaEditor > Navigator Window (Ctrl +D) > dictionary tab > Technical indicator > iCustom
You using shift 1 and 2 in 4hrs chart, that's gonna be very long.
The order select I mention before, write it like this.
MetaEditor > Navigator Window (Ctrl +D) > dictionary tab > Trading functions > OrderSelect()
I will write more about that OrderSelect() thing.
There are 2 order close, write it like this, both of them
MetaEditor > Navigator Window (Ctrl +D) > dictionary tab > Trading functions > OrderClose()
And I have different approach than RaptorUK's, that give same result though, there are 2 of these, and you have change both of them
Have fun
:)
Yes, tested in the strategy tester, and compiled it, getting the 'no errors, no warnings' response.
Ran it just now on audnzd from 17/05 to 22/05, and it opened 3 trades, 2 buys that were stopped out, and one sell that was closed at the end of the test.
Here's the Journal info, top line first.
2012.05.22 21:38:51 QQE-4hr_15min- testing-2205: loaded successfully
2012.05.22 21:38:53 QQE-4hr_15min- testing-2205 inputs: MagicNumber=0; Lots=1; Slippage=3; StopLoss=300; TakeProfit=1000; TrailingStop=300; Nbr_Period=10; Multiplier=3;
2012.05.22 21:38:53 2012.05.17 00:00 c_QQEA AUDNZD,H4: loaded successfully
2012.05.22 21:38:53 2012.05.17 00:00 c_QQEA AUDNZD,M15: loaded successfully
2012.05.22 21:39:13 2012.05.17 16:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: open #1 buy 1.00 AUDNZD at 1.29960 sl: 1.29660 ok
2012.05.22 21:39:13 2012.05.17 16:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: BUY order opened : 1.2996
2012.05.22 21:39:13 2012.05.17 18:32 Tester: stop loss #1 at 1.29660 (1.29660 / 1.29698)
2012.05.22 21:39:15 2012.05.18 20:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: open #2 buy 1.00 AUDNZD at 1.30386 sl: 1.30086 ok
2012.05.22 21:39:15 2012.05.18 20:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: BUY order opened : 1.3039
2012.05.22 21:39:15 2012.05.18 23:09 Tester: stop loss #2 at 1.30086 (1.30083 / 1.30121)
2012.05.22 21:39:16 2012.05.21 16:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: open #3 sell 1.00 AUDNZD at 1.29739 sl: 1.30039 ok
2012.05.22 21:39:16 2012.05.21 16:00 QQE-4hr_15min- testing-2205 AUDNZD,H4: SELL order opened : 1.2974
2012.05.22 21:39:17 2012.05.21 23:59 Tester: order #3 is closed
2012.05.22 21:39:17 2012.05.21 23:59 c_QQEA AUDNZD,M15: removed