For currency trading in MT4, we use magic numbers to identify individual trade. For the e-mini S&P trading, can we still use magic number?
- Help to close OP_BUYLIMIT
- What's the best trading system to S&P e-minis?
- Purchasing e-mini S&P 500, 1 minute historical data from 1998 to present
Yes
magic number is used to identify trades by a particular EA, not necessarily a particular symbol
Can someone explain this for me? When I am trading the EURUSD, I can use this routine to count orders and it works fine.
void Jas_CountOrder(int Jas_i5) { datetime dt = 0; nAll = 0; nBuy = 0; nSell = 0; for(int i=OrdersTotal()-1; i>=0; i--) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if(OrderMagicNumber() != Jasmine_magic[Jas_i5]) continue; if(OrderSymbol() != NULL) continue; nAll++; if(OrderType() == OP_BUY) nBuy++ ; if(OrderType() == OP_SELL) nSell++; } }
When I am trading the E-mini S&P, I have to comment out // if(OrderSymbol() != NULL) continue. If I don't then I don't get accurate count of the CountOrder.
void Jas_CountOrder(int Jas_i5) { datetime dt = 0; nAll = 0; nBuy = 0; nSell = 0; for(int i=OrdersTotal()-1; i>=0; i--) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if(OrderMagicNumber() != Jasmine_magic[Jas_i5]) continue; // if(OrderSymbol() != NULL) continue; nAll++; if(OrderType() == OP_BUY) nBuy++ ; if(OrderType() == OP_SELL) nSell++; } }
gooly:
Awesome, thank you.
I would never use NULL in your context! In some exists a replacement for NULL but - I am pretty sure - not here at least it's not save!
To exclude the non-chart-symbol use _Symbol (or Symbol()) instead!!
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