int OnInit()
{
{
int AcctNbr = 0;
if(AcctNbr > 0 && AcctNbr != AccountNumber())
{Print("Account not allowed"); return(-1);}}
//---- drawing settings
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);
//----
SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 0, Red);
//SetIndexDrawBegin(0, i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0, "Resistance");
//----
SetIndexStyle(1, DRAW_ARROW, STYLE_DOT, 0, Blue);
//SetIndexDrawBegin(1, i-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1, "Support");
//----
SetIndexStyle(2, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(2, 233);
SetIndexBuffer(2, BreakUp);
//----
SetIndexStyle(3, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(3, 234);
SetIndexBuffer(3, BreakDown);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
//----
for(int i = BarCount; i >=0; i--)
{
val1 = iFractals(NULL, 0, MODE_UPPER, i);
//----
if(val1 > 0)
{
v1[i] = High[i];
counter1 = 1;
}
else
{
v1[i] = v1[i+1];
counter1++;
}
val2 = iFractals(NULL, 0, MODE_LOWER, i);
//----
if(val2 > 0)
{
v2[i] = Low[i];
counter2 = 1;
}
else
{
v2[i] = v2[i+1];
counter2++;
}
if (v1[i] != LastResistance) { HighBreakPending = True; LastResistance = v1[i]; }
if (v2[i] != LastSupport) { LowBreakPending = True; LastSupport = v2[i]; }
double BPrice;
int AlertCandle;
if (HighLow) BPrice=High[i]; else BPrice=Close[i];
if (HighBreakPending && BPrice > v1[i] && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) < RSIOverbought &&
iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) > CCIBuyLevel)) && counter1 >= SignalDots) HighBreakout = TRUE;
if (HighLow) BPrice=Low[i]; else BPrice=Close[i];
if (LowBreakPending && BPrice < v2[i] && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) > RSIOversold &&
iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) < CCISellLevel)) && counter2 >= SignalDots) LowBreakout = TRUE;
if (AlertOnClose) AlertCandle = 1; else AlertCandle = 0;
if (HighBreakout)
{
if (i >= AlertCandle) BreakUp[i] = Low[i]-10*Point;
if (Alerts && i == AlertCandle && Bars > AlertBar)
{
Alert(Symbol(), " M", Period(), ": Resistance Breakout: BUY");
AlertBar = Bars;
}
HighBreakout = False;
HighBreakPending = False;
} else
if (LowBreakout)
{
if (i >= AlertCandle) BreakDown[i] = High[i]+10*Point;
if (Alerts && i==AlertCandle && Bars>AlertBar)
{
Alert(Symbol(), " M", Period(), ": Support Breakout: SELL");
AlertBar = Bars;
}
LowBreakout = False;
LowBreakPending = False;
}
}
return(0);
}
- Indonesian Member
- Metastock to MT4
- [WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you.
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019.05.06)
Messages Editor -
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
We can't know what line gives the error,
v2[i] = v2[i+1];
or what BarCount is and is it less than Bars-1.You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register