Original Turtles
Valvk talks about his turtle EA currently #2 in the championship. Turtle Power!!
InvestorMe Asked me to post this on it's own thread. It's not fully debugged. I don't know why it never opens any long positions. There's still alot about this strategy I don't yet understand.
Running backtest, it DOES open long and short positions...
The problem I had is that it only opens positions in backtest if I use "control points"...it doesn't open any orders at all if I use "every tick".
Weird.
I'm on IBFX...I'll start forward testing as soon as the market opens.
sstillwell
Also, look out for this...
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderComment()=="Trend Rider" && OrderMagicNumber()==MAGIC)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
else if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}[/CODE]
No orders ever get sent with the comment "Trend Rider", it should be:
[CODE]void ClosePending()
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderComment()=="Turtles" && OrderMagicNumber()==MAGIC)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
else if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}don't you think so?
Regards,
sstillwell
Also, look out for this...
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderComment()=="Trend Rider" && OrderMagicNumber()==MAGIC)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
else if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}[/CODE]
No orders ever get sent with the comment "Trend Rider", it should be:
[CODE]void ClosePending()
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderComment()=="Turtles" && OrderMagicNumber()==MAGIC)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
else if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}don't you think so?
Regards,
sstillwellYou're absolutely right. This is among a few more issues that are being worked on. I hope we could post the newer version soon so we can get contributions. Please, whoever wishes to contribute can do so and post the new version. It should be team work
Also a turtle man
hello,
Im also developing my own turtle EA, perhaps we could work together
Anyways I also started a thread for my Ninja Turtle!
heres the link: https://www.mql5.com/en/forum/175833
Ok Happy Holidays!
Mikhail
do not use ordercomment() to identify your trades, use ordermagicnumber() instead. some brokers modify comments of orders sent to them by an EA.
Good idea. We're already identifying by magic number, so matching comment is kind of redundant.
sstillwell
I fixed the close pending function....
It still wasn't working cause it didn't have anything selected... now it works
void ClosePending()
{
for(int i=0;i<=OrdersTotal(); i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() && OrderComment()=="Turtles" && OrderMagicNumber()==MAGIC)
{
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
else if (OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}
}
i know it's comparision is still redundant but that doesn't really effect anything so I didn't change it. Sometimes redundancy is security, if it doesn't hurt anything.
You shouldn't need to do that.
ClosePending() is called from within the PendingOrders() loop, where the order is already being selected.
What problem are you observing that makes you think it needs to be changed?
sstillwell
some orders weren't closing for me, that's all. I know I shouldn't have had to do it but something wasn't working. Seems that it is now.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
InvestorMe Asked me to post this on it's own thread. It's not fully debugged. I don't know why it never opens any long positions. There's still alot about this strategy I don't yet understand.