| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| FIFO for SH's shell EA https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2095 |
Page 1 of 1 |
| Author: | mobthehop [ Tue May 07, 2013 12:22 pm ] |
| Post subject: | FIFO for SH's shell EA |
I need some advise on how best to implement US FIFO compliance for a multi-lot, same lot size EA based on SH's shell EA in the close order portion of shell. I probably need to to put all open orders into an array, sort it on order entry date, oldest to newest and then close trades in that sorting order but I have no idea how to code it.... There are so many EAs based on this shell code - any kind soul willing to share.... I would be grateful Mop |
|
| Author: | jlcgarcia [ Tue May 07, 2013 12:54 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
Hi mobthehop, I think you will need something like this: Code: Select all Regards José Luis |
|
| Author: | mobthehop [ Tue May 07, 2013 2:07 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
JL, great stuff! Too late for me now but will will stick the snippet in tomorrow my time and let you know... Cheers - and thank you very very much! Mop |
|
| Author: | jlcgarcia [ Tue May 07, 2013 3:38 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
Hi Mob, A more workable and ready version will be this: Code: Select all Pleased check, and thell me if it works. Regards José Luis |
|
| Author: | mobthehop [ Wed May 08, 2013 5:41 am ] |
| Post subject: | Re: FIFO for SH's shell EA |
JL, took me a while to figure out - please note that you forgot to copy in one line in the "ready version" posted above this, but no biggy.... Code: Select all Code: Select all JL, thank you very much for helping out / Mop |
|
| Author: | SteveHopwood [ Sun May 12, 2013 5:32 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
Great stuff mop. I never thought of the FIFO stuff. When you are confident your code works, I will add it to my shell then have a InFifoJail input for the user. |
|
| Author: | mobthehop [ Sun May 12, 2013 5:59 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
SH, thanks but all credit goes to JL! I just did the adaptation to your variable nomenclature... Not sure that this needs to be added to the shell as it only applies to same-pair-multiple-orders EA for our friends across the pond.... but leave that in your capable hands... The code works just fine, it is in proper use for a couple of days already (on demo).... Cheers & JL really appreciate your coding skill, would love if you could share more so that we all can learn from you! (Hint!) Mop |
|
| Author: | mobthehop [ Tue May 14, 2013 1:20 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
Sorry, there is a bug in (my) the code.... I am trying to locate it... Goes without saying, dont use it! JL, or anybody else familiar with arrays, where would be the best place to stick this additional check in my code above: if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic) continue; would this work: { if(!OrderSelect(y,SELECT_BY_POS,MODE_TRADES)&& (OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber) continue;ArrayResize (CloseTrades,CloseCount+1); Sorry for the bother but the error is only apparent in multi-pair / multi lot situations and somebody with proper coding knowledge would save me a lot of time to field test this.... Cheers Mop |
|
| Author: | jlcgarcia [ Tue May 14, 2013 3:16 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
Hi Mob, I think you are right with your coding. The code must be something like this (if you want to use the same magicnumber for several pairs: Code: Select all Regards José Luis |
|
| Author: | mobthehop [ Tue May 14, 2013 3:42 pm ] |
| Post subject: | Re: FIFO for SH's shell EA |
José Luis, Thank you for taking the time! Actually each pair should use it's own magic number, but the check only open orders of same pair are closed is absolutely necessary [if(OrderSymbol()!=Symbol()] & was not not present before... I give it it try and will report back.... Muchas gracias JL.... |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|