Indicators with alerts/signal - page 1363

kapooo
12
kapooo  
hi Mladen , please am waiting anxiously for ur response on the filter image that i requested above .
Mladen Rakic
154345
Mladen Rakic  
borgesr:

Thank you Mladen.

Now it is working fine.

You usually use this type of indicator to the stop or is there some other more efficient method?


Regards,

Rogério

Rogério


As you could see when that indicator is attached to the chart, it is more a "trend" indicator or indicator that could be used for stops

Mladen Rakic
154345
Mladen Rakic  
TraderRob28:

mrtools or mladen

can to add in this indicator an alert + Messag when the arrow comes ?

thanks  

TraderRob28

Use the attached one (a bit different, but all in all, when the changes that must be done would be done, they would be the same)

PS: as any fractals indicator - it recalculates/repaints

Julio
63
Julio  
//+------------------------------------------------------------------+
//|                       Indicator: Signal_Stochastics_Strategy.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright " "
#property link      " "
#property version   "1.00"
#property description "Trade extreme levels of overbought and oversold"

#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 2

#property indicator_type1 DRAW_ARROW
#property indicator_width1 2
#property indicator_color1 0xFFAA00
#property indicator_label1 "CALL opportunity"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 2
#property indicator_color2 0x006AFF
#property indicator_label2 "PUT opportunity"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | Signal_Stochastics_Strategy @ "+Symbol()+","+Period()+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 241);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   SetIndexArrow(1, 242);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      //Indicator Buffer 1
      if(iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i) > iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i)
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i+1) < iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i+1) //Stochastic Oscillator crosses above Stochastic Oscillator
      && iStochastic(NULL, PERIOD_CURRENT, 14, 3, 3, MODE_SMA, 0, MODE_MAIN, i) < 20 //Stochastic Oscillator < fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 14, 3, 3, MODE_SMA, 0, MODE_SIGNAL, i) < 20 //Stochastic Oscillator < fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i) < 20 //Stochastic Oscillator < fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i) < 20 //Stochastic Oscillator < fixed value
      )
        {
         Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
        }
      //Indicator Buffer 2
      if(iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i) < iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i)
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i+1) > iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i+1) //Stochastic Oscillator crosses below Stochastic Oscillator
      && iStochastic(NULL, PERIOD_CURRENT, 14, 3, 3, MODE_SMA, 0, MODE_MAIN, i) > 80 //Stochastic Oscillator > fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 14, 3, 3, MODE_SMA, 0, MODE_SIGNAL, i) > 80 //Stochastic Oscillator > fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_MAIN, i) > 80 //Stochastic Oscillator > fixed value
      && iStochastic(NULL, PERIOD_CURRENT, 21, 9, 9, MODE_SMA, 0, MODE_SIGNAL, i) > 80 //Stochastic Oscillator > fixed value
      )
        {
         Buffer2[i] = High[i]; //Set indicator value at Candlestick High
        }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
Julio
:

Dear mladen can you please take a look at my post?. Thank you in advance for your help.

https://www.mql5.com/en/forum/180648/page906 


Mladen Rakic
154345
Mladen Rakic  
Julio:

Julio


When a new arrow appears?

Mladen Rakic
154345
Mladen Rakic  
Julio:

???

Any clarification?

Mladen Rakic
154345
Mladen Rakic  
Julio:

Add :


if (Buffer1[0]!=EMPTY_VALUE) ... alert for buy

if (Buffer2[0]!=EMPTY_VALUE) ... alert for sell

myname
3231
myname  
Julio:

Why are you using SetAsSeries on buffers that are already used as buffers (series)?

That is not MT5

Mladen Rakic
154345
Mladen Rakic  
kewu:
hi Mladen , please am waiting anxiously for ur response on the filter image that i requested above .

kewu


As I told : from a picture I can not tell anything

techmac
2973
techmac  
arbtrader:
As seen from chart H4, the pair is traded at 1.27082. ADX is 28.51 along with the green SAR arrow, showing a relatively strong uptrend. The stock is expected to go down slightly then go up again. I'm going long with SL at 1.26505 and TP at 1.27806
Which pair?