Coding help - page 775

 

Kindly help me this issue.

Below is MA cross alert, but I got too many messages per 1 same notification.

I just wanna get 1 notification per 2 consecutive bars, it means number of bars is 2 to skip before next alert.

How can I do, kindly help me. Thank you so much



//+------------------------------------------------------------------+

//|                MA Cross Arrows.mq4                               |

//|                Copyright © 2006  Scorpion@fxfisherman.com        |

//+------------------------------------------------------------------+

#property copyright "FxFisherman.com"

#property link      "http://www.fxfisherman.com"



#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 Blue

#property indicator_color2 White

#property indicator_color3 Red



extern int Crossed_Pips = 0;

extern int MA_Period = 21;

extern int MA_Type = MODE_SMA;

extern int Shift_Bars=0;

extern int Bars_Count= 1000;

int state;

  

//---- buffers

double v1[];

double v2[];

double v3[];

  





int start()

 {

  double ma;

  int previous;

  int i;

  int shift;

  bool crossed_up, crossed_down;

  int totalBars = Bars - (MA_Period * 2);

  

  if (Bars_Count > 0 && Bars_Count <= totalBars)

  {

    i = Bars_Count;

  }else if(totalBars <= 0 ) {

    return(0);

  }else{

    i = totalBars;

  }

  

  while(i>=0)

   {

    shift = i + Shift_Bars;

    ma = iMA(Symbol(), Period(), MA_Period, 0, MA_Type, PRICE_CLOSE, shift);

    crossed_up = High[shift] >= (ma + (Crossed_Pips * Point));

    crossed_down = Low[shift] <= (ma - (Crossed_Pips * Point));



    v1[i] = NULL;

    v2[i] = NULL;    

    v3[i] = ma;

    if (crossed_up && previous != 1) {

      v1[i] = ma + (Crossed_Pips * Point);

      previous = 1;

    }else if(crossed_down && previous != 2){

      v2[i] = ma - (Crossed_Pips * Point);

      previous = 2;

    }

 

    i--;

   }

   

   ma = iMA(Symbol(), Period(), MA_Period, 0, MA_Type, PRICE_CLOSE, 0);

   if (Close[0] >= ma + (Crossed_Pips * Point) && state != 1) { 

      state = 1;

      SendNotification(Symbol() + "M"+_Period + " Price crossed UP EMA21.");

   }else if (Close[0] <= ma - (Crossed_Pips * Point) && state != -1) {

      state = -1;

      SendNotification(Symbol() + "M"+_Period + " Price cross DOWN the EMA21.");

   }



   return(0);

 }
 

When I declare a extern variable I get an error message "extern-unexpected token"

Please help

Files:
error1.zip  116 kb
 
Ricardo Schuller:

When I declare a extern variable I get an error message "extern-unexpected token"

Please help

you cannot use extern inside a method or function.

 

how to fix error ??

 
Mo3tasemovic:

how to fix error ??

"GBPUSD"

 
Keith Watford:

"GBPUSD"

thanks

 
pivboll:

Help need to modify an indicator

I am trying to modify a MACD indicator to turn it into a Trend Thrust Indicator as described in Buff Dormeier book Investing with volume analysis.

I have issues with the variable and can not achieve a decent result. I am attaching the volWMA and the VW MACD that are working

Here is the description

Trend thrust indicator

The trend thrust indicator (Tti), an enhanced version of the volume-weighted moving average convergence/divergence (VW-Macd) indicator, was introduced in my book Investing With Volume Analysis. The Tti uses a volume multiplier in unique ways to exaggerate the impact of volume on volume-weighted moving averages. Like the VW-Macd, the Tti uses volume-weighted moving averages as opposed to exponential moving averages. Volume-weighted averages weigh closing prices proportionally to the volume traded during each time period, so the Tti gives greater emphasis to those price trends with greater volume and less emphasis to time periods with lighter volume. In the February 2001 issue of Stocks & Commodities, I showed that volume-weighted moving averages (Buff averages, or Vwmas) improve responsiveness while increasing reliability of simple moving averages.

Like the Macd and VW-Macd, the Tti calculates a spread by subtracting the short (fast) average from the long (slow) average. This spread combined with a volume multiplier creates the Buff spread

The calculation are the following

volume multiplier = fast VolWMA / slow VolWMA

the volume multiplier is taken to the second power and then multiplied by the fast VolWMA to give Volume enhance fast average

the volume multiplier is taken to the second power and then multiplied by the SLOW VolWMA to give Volume enhance slow average

TTi = enhance fast average - enhance slow average

Thank for your help

 

indicator link: https://www.sendspace.com/file/rfy2dv&nbsp;

Hello my friend. Have you ever got the TTI sorted out? Can you share here or send me via PM? Thanks

 
Hi
Could you plz help me with this problem
I need an EA which send push notification whenever the price bid diffrence from kinjun sen (in ichimoku) is bigger than 3 pips (30 points) in 1 minute time fream
 

hai,


pls add sound alert,message alert and mobile notification option for this indicator.

thanks

Files:
 

Hi

I found the topics like "iCustom returns wrong values" but this is little bit different.

I try to create indicator which compares size of identical type of bars (bull/bear type) in a sequence.

and shows maximum values of comparison in histogram.

like this.

max_value

//-----------------------------

with ArrayMaximum the result is more faster. but there is something wrong with my code.example:

iCustom_diff

here is the code which compares iCustom values and returns wrong values:

#property indicator_separate_window
#property indicator_buffers 4


#property indicator_color1 DeepSkyBlue
#property indicator_width1 10


#property indicator_color2 Red
#property indicator_width2 10



#property indicator_color3 DodgerBlue
#property indicator_width3 4


#property indicator_color4 Crimson
#property indicator_width4 4


#property indicator_level1 0
#property indicator_levelcolor White
#property indicator_levelstyle 0


string LF = "\n";  // use this in custom or utility blocks where you need line feeds
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar


double Buffer1[];
double Buffer2[];

double Buffer3[];
double Buffer4[];


double bar_0;
double bar_1;
double bar_2;
double bar_3;
double bar_4;
double bar_5;
double bar_6;
double bar_7;
double bar_8;
double bar_9;
double bar_10;
double bar_11;


//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart

    IndicatorDigits(Digits-5);
    IndicatorBuffers(4);
    
    SetIndexBuffer(0, Buffer1);
    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer2);
    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    
    
    SetIndexBuffer(2, Buffer3);
    SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
    
    SetIndexBuffer(3, Buffer4);
    SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);
    
    
    return(0);
}


//+------------------------------------------------------------------+
int deinit()
{
if (false) ObjectsDeleteAll();

return(0);
}


//+------------------------------------------------------------------+
int start()
{
OnEveryTick1();

return(0);
}
//+------------------------------------------------------------------+
void OnEveryTick1()
{
    
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars - 1;
    // main calculation loop
    while (i >= 0)
    
{
current = i;
        
//current  >0
//current+1=0
TechnicalAnalysis00();

//current  >0
//current+1>0
//current+2=0
TechnicalAnalysis01();

//current  >0
//current+1>0
//current+2>0
//current+3=0
TechnicalAnalysis02();


i--;
}
}

//-----------------------------------------------------
//---------bar_0-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis00()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);

if
(
bar_0 > 0
&&
bar_1 == 0
)

{
Histogram00();
}

}

void Histogram00()
{
Buffer1[current]= bar_0;
}
//-----------------------------------------------------
//---------bar_1-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis01()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 == 0
)

{
Histogram01();
}

}

void Histogram01()
{
int x_up_01[] = {0,0};

x_up_01[0] = bar_0;
x_up_01[1] = bar_1;

int maxValue_01 = ArrayMaximum(x_up_01);

Buffer1[current]= x_up_01[maxValue_01];
}
//-----------------------------------------------------
//---------bar_2-------------------------------
//-----------------------------------------------------
void TechnicalAnalysis02()
{

bar_0 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current);
bar_1 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+1);
bar_2 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+2);
bar_3 = iCustom(NULL, NULL, "candles_from_chart-celi_masivi",0,current+3);

if
(
bar_0 > 0
&&
bar_1 > 0
&&
bar_2 > 0
&&
bar_3 == 0
)

{
Histogram02();
}

}

void Histogram02()
{
int x_up_02[] = {0,0,0};

x_up_02[0] = bar_0;
x_up_02[1] = bar_1;
x_up_02[2] = bar_2;

int maxValue_02 = ArrayMaximum(x_up_02);

Buffer1[current]= x_up_02[maxValue_02];
}
//-----------------------------------------------------
//---------bar_3--------and so on-----------------------
//-----------------------------------------------------

where is my mistake? how can I fix it?
I tried to call iCustom with all extern param.  - same wrong result. I tried with no extern param. iCustom - same wrong result. 

thanks for help

main code (first histogram) and second code (second histogram) based on it :

Reason: