From 2a2d51c196aa9370ff0cfd54f2f5e48befc94db9 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 12 Mar 2020 08:55:19 +0100 Subject: [PATCH] Create Chart Background by MAs.mq5 --- MA/Chart Background by MAs.mq5 | 229 +++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 MA/Chart Background by MAs.mq5 diff --git a/MA/Chart Background by MAs.mq5 b/MA/Chart Background by MAs.mq5 new file mode 100644 index 0000000..c5199dd --- /dev/null +++ b/MA/Chart Background by MAs.mq5 @@ -0,0 +1,229 @@ +// Chart Background by MAs + +#property copyright "2020, getYourNet.ch" +#property link "http://www.getyournet.ch" + +#property indicator_chart_window +#property indicator_buffers 2 +#property indicator_plots 2 +#property indicator_label1 "Fast MA Style" +#property indicator_label1 "Slow MA Style" +#property indicator_type1 DRAW_LINE +#property indicator_type2 DRAW_LINE +#property indicator_color1 DodgerBlue +#property indicator_color2 DodgerBlue + +input int InpMAPeriod1=20; // Fast MA Period +input int InpMAPeriod2=200; // Slow MA Period +input ENUM_MA_METHOD InpMAMethod=MODE_SMA; // MA Method +input color ColorUptrend=C'248,255,253'; // Color Uptrend +input color ColorDowntrend=C'255,252,252'; // Color Downtrend +input color ColorNotrend=White; // Color No Trend + +double ExtLineBuffer1[]; +double ExtLineBuffer2[]; +enum TypeState +{ + Uptrend, + Downtrend, + Notrend +}; +int LastState; + + +void CalculateSimpleMA(int rates_total,int prev_calculated,int begin,const double &price[], int InpMAPeriod, double &ExtLineBuffer[]) +{ + int i,limit; + if(prev_calculated==0) + { + limit=InpMAPeriod+begin; + for(i=0; i0) + { + int c=prev_calculated-1; + + TypeState state=Notrend; + + if(ExtLineBuffer1[c]>ExtLineBuffer2[c]) + state=Uptrend; + + if(ExtLineBuffer1[c]ExtLineBuffer2[c]; + bool isdowntrend=ExtLineBuffer1[c]