...and my sell orders aren't getting modified - getting error 4051 and 130
for(int pos = 0; pos <= OrdersTotal(); pos++) { OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES); if(OrderSymbol() != Symbol() && OrderMagicNumber() != MagicNumber) BandPierced = false; if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { IsTrade++; if(OrderType() == OP_BUY) { if(Close[1] > UpperBB || High[1] > UpperBB) BandPierced = true; if(BandPierced) { if(Low[1] > OrderStopLoss()) { ModStop = Low[1]; OrderModify(OrderTicket(),OrderOpenPrice(),ModStop,0,0,CLR_NONE); } } if(Close[1] < TwentyEMA - Window * Point) { Closed = OrderClose(OrderTicket(),OrderLots(),Bid,MarketInfo(Symbol(),MODE_SPREAD),CLR_NONE); } //order } if (OrderType() == OP_SELL) { if(Close[1] < LowerBB || Low[1] < LowerBB) BandPierced = true; if(BandPierced) { if(High[1] < OrderStopLoss()) { ModStop = High[1]; OrderModify(OrderTicket(),OrderOpenPrice(),ModStop,0,0,CLR_NONE); } } if(Close[1] > TwentyEMA + Window * Point) { Closed = OrderClose(OrderTicket(),OrderLots(),Ask,MarketInfo(Symbol(),MODE_SPREAD),CLR_NONE); } } } }
Lol ok. Well said. Btw, I'm getting 20% profit over a year with 90% modeling quality. Almost there:)
Have you try Optimization? You can get more.
Have you try Optimization? You can get more.
There aren't too many optimizable parameters - but whenever I try to optimize(i select just one parameter, check optimize) but when I run the tester there is nothing there
but when I run the tester there is nothing there
for(int pos = 0; pos <= OrdersTotal(); pos++) { OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES); if(OrderSymbol() != Symbol() && OrderMagicNumber() != MagicNumber) BandPierced = false; if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)You can NOT use OrderTicket() until you AFTER a OrderSelect() Always test return codes.
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){
There aren't too many optimizable parameters - but whenever I try to optimize(i select just one parameter, check optimize) but when I run the tester there is nothing there
I realise quite a lot tend to make this mistake. After checking optimize, and the parameters, you also MUST give values to step!=0, etc.
Then open your optimization graph to see which parameter value, in increment/decrement step value, gives the best balance, or any other optimization vrb you choose.
I realise quite a lot tend to make this mistake. After checking optimize, and the parameters, you also MUST give values to step!=0, etc.
Then open your optimization graph to see which parameter value, in increment/decrement step value, gives the best balance, or any other optimization vrb you choose.
Yeah, even after I give values to step and stop(in the strategy tester menu right?), and when the test is done the balance graph is blank, and so is the optimization graph
Roll your sleeves up, add some (many) Print() statements and find what is going on.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, this for loop doesnt work - trades are still being taken even 4-7 candles after the MA cross