Strategy not taking multiple positions
8 replies
Jason R
8 years ago #114101
I’ve built a strategy that should trigger the entry signal multiple times before the exit signal, yet it is only taking the first entry. How can I get this to take every signal?
Also, How would I set a max number of concurrent open positions once I do get this to take every signal?
Thanks
tomas262
8 years ago #132212
If you want to enter multiple times in a row before exiting you need to define different Magic Numbers of each entry order. With this simple strategy you can do following
1) define ‘RandNumber’ variable type INT in EA Wizard
2) to you entry rules add ‘Custom Action’ and type this command: ‘RandNumber = MathRand();
3) edit your order to have Magic Number = RandNumber
Jason R
8 years ago #132214
It will not pass validity. It says same magic number being used for more than one order.
See attached.
tomas262
8 years ago #132217
Try to make RandNumber2 for short side. Let me know if any troubles setting it up …
Jason R
8 years ago #132218
I was just going to post that I figured that out. I made “RandNumberLong” and “RandNumberShort”.
Thanks.
Jojo
8 years ago #135998
If you want to enter multiple times in a row before exiting you need to define different Magic Numbers of each entry order. With this simple strategy you can do following
1) define ‘RandNumber’ variable type INT in EA Wizard
2) to you entry rules add ‘Custom Action’ and type this command: ‘RandNumber = MathRand();
3) edit your order to have Magic Number = RandNumber
Sorry Guys, I have tried that way of resolving magic number problem for a series of trades, it is not working. I am doing it wrong somewhere. Here is what I have done. Your guidance with screen shots will help me lots – you can tell am not a programer YET!
tomas262
8 years ago #136007
Jojo
8 years ago #136011
Jojo
8 years ago #136012
Thank you Tomas, will work with this and let you know.
I have used the sqw file provided. Validity test on first page – worked. After I cloned the rule set for the next tab, and changed conditions – validity failed – for even first tab!
BUT – when I deleted the second tab, validity test was OK for the first tab. I tried to add a digit: to RandomNumber2 = MathRand(); – Didn’t work.
** Another issue I would seek advice about: In my ea I had programmed to close all orders after one event. Now on reviewing notes and videos, it appears, this “Close all” function will close all open positions on all charts irrespective of where the ea is! What I want is to be able to open multiple positions on SINGLE CHART and close them all ON THAT chart if a certain condition is fulfilled. Open trades on other charts have to remain open as long as the rules allow.
Viewing 8 replies - 1 through 8 (of 8 total)