MnQInvestmentDevelopment/MnQInvestment/02_EigeneScalpingprojekte/TrendlineBreaker-V1.mq5
super.admin cff55d2704 convert
2025-05-30 15:08:44 +02:00

58 lines
2.2 KiB
MQL5

//+------------------------------------------------------------------+
//| TrendlineBreaker-V1.mq5 |
//| Copyright 2023, M & Q Investment Group |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, M & Q Investment Group"
#property link "https://www.mql5.com"
#property version "1.00"
int HandleValZigZag;
int HandleRSI;
int MaximalZigZagBufferRange = 200;
input int MinimumHigLowCandleIndex = 3;
int OnInit(){
string NameValZigZag = "Market\\Valable ZigZag MT5.ex5";
HandleValZigZag = iCustom(_Symbol,PERIOD_CURRENT,NameValZigZag,1,1,false);
HandleRSI = iRSI(_Symbol,PERIOD_CURRENT,14,PRICE_CLOSE);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){
}
void OnTick(){
double ZigZagValueComp[4][2];
double RSIValue[];
CopyBuffer(HandleRSI,0,0,1,RSIValue);
int CountFoundHighLow = 0;
double ZigZagValue[];
CopyBuffer(HandleValZigZag,1,MaximalZigZagBufferRange,1,ZigZagValue);
//ArraySetAsSeries(ZigZagValue,true);
for(int i = MinimumHigLowCandleIndex; i < MaximalZigZagBufferRange -1; i++){
if(ZigZagValue[i] > 0 && CountFoundHighLow < 4){
ZigZagValueComp[CountFoundHighLow][0] = ZigZagValue[0];
ZigZagValueComp[CountFoundHighLow][1] = i;
CountFoundHighLow ++;
}
if(CountFoundHighLow == 4){break;}
}
int CurrDirectUp1Down2No0 = 0;
if(ZigZagValueComp[0][0] < ZigZagValueComp[1][0]){CurrDirectUp1Down2No0 = 1;}
else if(ZigZagValueComp[0][0] > ZigZagValueComp[1][0]){CurrDirectUp1Down2No0 = 2;}
Comment("\nZigZagValueComp[0][0]: ",ZigZagValueComp[0][0]," Index: ",ZigZagValueComp[0][1],
"\nZigZagValueComp[1][0]: ",ZigZagValueComp[1][0]," Index: ",ZigZagValueComp[1][1],
"\nZigZagValueComp[2][0]: ",ZigZagValueComp[2][0]," Index: ",ZigZagValueComp[2][1],
"\nZigZagValueComp[3][0]: ",ZigZagValueComp[3][0]," Index: ",ZigZagValueComp[3][1],
"\nCurrDirectUp1Down2No0: ",CurrDirectUp1Down2No0);
}