
extern string IndName2 = "AscTrend 2_SSA_Alert";
extern int Risk=0;
extern double MONYRISK=1.5;
extern int LagFast = 20;
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double lim = iCustom(NULL,0,IndName,Length1,Phase1,Shift1,Input_Price_Customs1,Length2,Phase2,Shift2,Input_Price_Customs2,Ndot_Cool2_JMA_1,Ndot_Cool2_JMA_2,CCF_MA,CJCF_MA,Ndot_CJCF_1,Ndot_CJCF_2,CountBars,Ma_PeriodStd,Ma_Method,Ma_Price,14,Shift);
double red = iCustom(NULL,0,IndName,Length1,Phase1,Shift1,Input_Price_Customs1,Length2,Phase2,Shift2,Input_Price_Customs2,Ndot_Cool2_JMA_1,Ndot_Cool2_JMA_2,CCF_MA,CJCF_MA,Ndot_CJCF_1,Ndot_CJCF_2,CountBars,Ma_PeriodStd,Ma_Method,Ma_Price,15,Shift);
double blue= iCustom(NULL,0,IndName2,Risk,MONYRISK,LagFast,0,Shift);
double crim= iCustom(NULL,0,IndName2,Risk,MONYRISK,LagFast,1,Shift);
bool buy=lim>0 && Bid>blue && blue!=EMPTY_VALUE;
bool sell=red>0 && Bid<crim && crim!=EMPTY_VALUE;
if(BULevel>0)
BU();
if(TrailingStop>0)
Trailing();
if(CountTrades()<1 && TimeSession(StartHour,StartMin,EndHour,EndMin,TimeCurrent()))
{
if(buy)
{
PutOrder(0,Ask);
}
if(sell)
{
PutOrder(1,Bid);
}
}
else
{
if(sell)
{
CloseAll(0);
}
if(buy)
{
CloseAll(1);
}
}
if(!TimeSession(StartHour,StartMin,EndHour,EndMin,TimeCurrent()) && CloseOn>0)
CloseAll();
Comment("\n lim: ",lim,
"\n red: ",red);
}
//+------------------------------------------------------------------+
если выставленный ордер удалять вручную
Открытие рыночного ордера относительно прошлой свечи(min<max -buy, наоборот sell)
AM2