Quote:
Originally Posted by FerruFx
Here's what you need:
if(timeprev!=Time[0]) //---- it will execute the following only if a new bar started
{
YOUR CODE HERE;
timeprev = Time[0]; //---- it register here the open time of the current bar
}
Hope that helps,
FerruFx
|
It would look like that???:
Quote:
//------------------- order management1 -------------------//
if(timeprev!=Time[0]) //---- it will execute the following only if a new bar started
{
//---------------- check indicators and look for a CLOSE1 ---//
if (TotalOpenOrders() == OpenOrders)
{
if (OrderType() == OP_BUY) {
if (sMain<sSignal) { CloseAll(); }
}
if (OrderType() == OP_SELL) {
if (sMain>sSignal) { CloseAll(); }
}
} // end of if we have orders
timeprev = Time[0]; //---- it register here the open time of the current bar
}
//Trailing stop
if(UseTrailingStop && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
}
}
}
}
//Close
//---------------- open management ---------------
if (ElapsedTimeCheck(WaitMinutes) == true) {
//---------------- check indicators and look for a ORDER ENTRY1 ---//
if (TotalOpenOrders() < OpenOrders)
{
if ((MACDValue>MACDSignal)&&(sMain>sSignal)&&(di_p>di _m)&&(adx>ADXStrongTrend)&&(ItrendFilter && iTredn2>ItrendLevel && iTredn2>iTredn1) ||!ItrendFilter) // BUY
{
OrderSend(Symbol(),OP_BUY,LotSize(),Ask,Slippage,A sk-SL*Point,Ask+TP*Point,EAComment,MagicNumber,0,Lime );
}
if ((MACDValue<MACDSignal)&&(sMain<sSignal)&&(di_m>di _p)&&(adx>ADXStrongTrend)&&(ItrendFilter && iTredn1>ItrendLevel && iTredn1>iTredn2) ||!ItrendFilter) // SELL
{
OrderSend(Symbol(),OP_SELL,LotSize(),Bid,Slippage, Bid+SL*Point,Ask-TP*Point,EAComment,MagicNumber,0,Red);
}
} // end of if no orders exist
} // end of main loop
|
--------------------------------
It look to work on compile but i get error now about the:
ElapsedTimeCheck - expression on a global scope not allowed
WaitMinutes - expression on a global scope not allowed
ShowInfo - is not referenced ..... but i got the code at the end:
void ShowInfo()
{
Comment("...::: Inzider EA FULL :::...\n",
"Copyright © 2008 Inzider\n",
"Currency Pair: ", Symbol(),"\n",
"Price: ",NormalizeDouble(Bid,4),"\n",
"Date: ",Month(),"-",Day(),"-",Year()," Server Time: ",Hour(),":",Minute(),":",Seconds(),"\n",
"Minimum Lot Size: ",MarketInfo(Symbol(),MODE_MINLOT));
return(0);
}
So i don't understand why i get these error.