Indicators: Thrust_Bar

 

Thrust_Bar:

Indicator Thrust Bar

Thrust_Bar

Author: Scriptor

 
Good day ! Can you calculate by high and low, not by candle body ?
 
Auma #:
Good day ! Can you calculate by high and low, not by the body of the candle ?

Change it yourself.


 
Vitaly Muzichenko #:

Change yourself


I changed it, but it shows only one bar, green bars, but no red bars. Changed ATR settings, it shows the same thing.

 
Auma #:

I changed it, but it shows only one bar, green bars, but no red bars. Changed ATR settings, it shows the same thing.

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[])
  {
//--- Setting buffer arrays as time series
   ArraySetAsSeries(open,true);
   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   ArraySetAsSeries(close,true);
   ArraySetAsSeries(time,true);
//--- Check the number of available bars
   if(rates_total<period_max) return 0;
//--- Checking and calculating the number of bars to be calculated
   int limit=rates_total-prev_calculated;
   if(limit>1)
     {
      limit=rates_total-1;
      ArrayInitialize(BufferUP,EMPTY_VALUE);
      ArrayInitialize(BufferDN,EMPTY_VALUE);
      ArrayInitialize(BufferCandleOpen,EMPTY_VALUE);
      ArrayInitialize(BufferCandleHigh,EMPTY_VALUE);
      ArrayInitialize(BufferCandleLow,EMPTY_VALUE);
      ArrayInitialize(BufferCandleClose,EMPTY_VALUE);
      ArrayInitialize(BufferColors,2);
      ArrayInitialize(BufferATR,0);
     }
//--- Data preparation
   int count=(limit>1 ? rates_total : 1),copied=0;
   copied=CopyBuffer(handle_atr,MAIN_LINE,0,count,BufferATR);
   if(copied!=count) return 0;

//--- Calculating the indicator
   static datetime last_time=0;
   for(int i=limit; i>=0 && !IsStopped(); i--)
     {
      BufferCandleOpen[i]=BufferCandleHigh[i]=BufferCandleLow[i]=BufferCandleClose[i]=EMPTY_VALUE;
      BufferColors[i]=2;
      double x=(InpMethod==IND_METHOD_ATR ? multiplier*BufferATR[i]/Point() : multiplier);
      double y=(high[i]-low[i])/Point();
      double c=(close[i]-open[i])/Point();
      if(y>x && c>=0 && InpUseLong)
        {
         BufferUP[i]=low[i];
         BufferCandleOpen[i]=open[i];
         BufferCandleHigh[i]=high[i];
         BufferCandleLow[i]=low[i];
         BufferCandleClose[i]=close[i];
         BufferColors[i]=0;
         if(i==0 && last_time!=time[0])
           {
            string message=Symbol()+", "+TimeframeToString(Period())+": Thrust Bullish Bar at "+TimeToString(TimeCurrent());
            if(InpUseAlerts) Alert(message);
            if(InpSendMail  && TerminalInfoInteger(TERMINAL_EMAIL_ENABLED)) SendMail("Thrust Bar Signal",message);
            if(InpSendPush && TerminalInfoInteger(TERMINAL_NOTIFICATIONS_ENABLED)) SendNotification(message);
            last_time=time[0];
           }
        }
      if(y>x && c<0 && InpUseShort)
        {
         BufferDN[i]=high[i];
         BufferCandleOpen[i]=open[i];
         BufferCandleHigh[i]=high[i];
         BufferCandleLow[i]=low[i];
         BufferCandleClose[i]=close[i];
         BufferColors[i]=1;
         if(i==0 && last_time!=time[0])
           {
            string message=Symbol()+", "+TimeframeToString(Period())+": Thrust Bearish Bar at "+TimeToString(TimeCurrent());
            if(InpUseAlerts) Alert(message);
            if(InpSendMail  && TerminalInfoInteger(TERMINAL_EMAIL_ENABLED)) SendMail("Thrust Bar Signal",message);
            if(InpSendPush && TerminalInfoInteger(TERMINAL_NOTIFICATIONS_ENABLED)) SendNotification(message);
            last_time=time[0];
           }
        }
     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
 
It seems to have worked , never changed or written indicators , it worked from the tenth time .Maybe it can be added here , who will find it useful too ? Thanks for your attention !
Files:
Thrust_Bar1.mq5  18 kb
This website uses cookies. Learn more about our Cookies Policy.