• Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)

Question I found a good EA, but EA needs breakeven. Who will help ???

the scrolling ratio is very high when entering and exiting operations. therefore, it never matches the back test.
 
I worked in detail. my opinion. To be successful '' number of trade to be entered in that bar '', the setting is to add.
 
input bool LimitBar=true; // Limitar 1 ordem por vela?
input int MaxOrders = 2;

datetime LastOrderBar; // Store the last candle with opened order


void OnTick(){

//... code above, not important
//... MySignalPoint --> Is the point i allow the buy/swll
//... Not here because is too large and is not on the scope of this thread

// If LimitBar is TRUE, check if last order was in the current bar
// If LimitBar is FALSE, set true to bar_none_order to allow more orders on same bar
bool bar_none_order = !LimitBar || LastOrderBar != Time[0];

// If MaxOrders = 0, no_max_orders must be defined as TRUE, to not limit number of orders
// If MaxOrders > 0, then check if opened orders of current the asset is smaller than MaxOrders, and if smaller,
// set no_max_orders too, because need to allow new orders till reach the limit.
bool no_max_orders = MaxOrders == 0 ||( CountOpenOrders() < MaxOrders );

// Here i check if all conditions are true to allow opening orders
if( bar_none_order && no_max_orders && MySignalPoint){
Neworder(cmd); // BUY/SELL
LastOrderBar = Time[0]; // Here i store the last bar that has an order opened
}

}


int CountOpenOrders()
{
int count=0;

for( int i=OrdersTotal()-1; i>=0; i--)
{
if( OrderSelect( i, SELECT_BY_POS ) )
{
if( OrderSymbol() == Symbol() && OrderMagicNumber() == MyMagicNumber ){
count++;
}
}
}

return count;
}
 
Back
Top