Coding help - page 462

 
wranger:
Hi mladen, thanks for pointing me in the right direction. Don't know if my last reply went through but I just downloaded this one:

Forex TSD - forex forum - Download Angle of NonLag MA 1.01.mq4

And this looks like what i was looking for.

However I saw an earlier version from there that had exactly what i had in mind though:

https://www.mql5.com/en/forum/173056/page4 (file Forex TSD - forex forum - Download !!! Angle of average.mq4 )

Unfortunately that doesn't work anymore for the present mt4.... is it possible to make a MA on chart version of this one Forex TSD - forex forum - Download Angle of NonLag MA 1.01.mq4 ?

wranger

The updated version of "angle of average" compatible with new mt4 as posted here : https://www.mql5.com/en/forum/173056/page5

 

hello, what do I have to add to the indicator code, if I want to see the price that triggered the alarm in the alarm window?

 

HI Mladen,

I am going to ask you a big favour ..... Can you please change this code to Mt4 indicator ..... Its written in Amibroker language ...

Can you please help me .... It can be changed to Blue, Red, and neutral color grey in histogram version.

Thanks a lot.

*************************************************************

_SECTION_BEGIN("Elder Impulse");

radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius

textoffset = 0.1 * radius;

GfxSelectFont("Arial", 9, 500, True );

///////////////////////////////////////////////////

SetChartOptions(0,chartShowArrows|chartShowDates);

EnableTextOutput(False);

// User-defined parameter for EMA periods

EMA_Type = Param("EMA-1, TEMA-2, JMA-3", 2, 1, 3, 1);

EMA_prds = Param("EMA_periods", 7, 1, 30, 1);

Std_MACD = Param("Standard MACD? No-0, Yes-1", 1, 0, 1, 1);

Plot_fashion = Param("Bar+Arrows-1, Impulse Bars-2", 2, 1, 2, 1);

// Allow user to define Weekly and Monthly Ribbon Location and Height

WR_P1 = Param("Weekly Ribbon Location", 5.2, -1000, 1000, 0.1);

WR_P2 = Param("Weekly Ribbon Height", 199, -0.001, 500, 0.1);

// Compute EMA and MACD Histogram

if(EMA_Type == 1)

{

DayEMA = EMA(Close, EMA_prds);

}

if (EMA_Type == 2)

{

DayEMA = TEMA(Close, EMA_prds);

}

Histogram = MACD() - Signal();

// Determine if we have an Impulse UP, DOWN or None

Impulse_Up = DayEMA > Ref(DayEMA, -1) AND Histogram > Ref(Histogram, -1);

Impulse_Down = DayEMA < Ref(DayEMA, -1) AND Histogram < Ref(Histogram, -1);

Impulse_None = (NOT Impulse_UP) AND (NOT Impulse_Down);

// Compute Weekly MACD and determine whether rising or falling

TimeFrameSet(inWeekly);

if (Std_MACD == 0)

{

MACD_val = MACD(5, Cool);

Signal_val = Signal(5, 8, 5);

}

else

{

MACD_val = MACD(12, 26);

Signal_val = Signal(12, 26, 9);

}

Hist_in_w = MACD_val - Signal_val;

wh_rising = Hist_in_w > Ref(Hist_in_w, -1);

wh_falling = Hist_in_w < Ref(Hist_in_w, -1);

wh_none = (NOT wh_rising) AND (NOT wh_falling);

TimeFrameRestore();

// Now get Monthly MACD Histogram....

TimeFrameSet(inMonthly);

MACD_val = MACD(5, 8);

Signal_val = Signal(5, 8, 5);

Hist_in_m = MACD_val - Signal_val;

mh_rising = Hist_in_m > Ref(Hist_in_m, -1);

mh_falling = Hist_in_m < Ref(Hist_in_m, -1);

TimeFrameRestore();

wh_rising = TimeFrameExpand( wh_rising, inWeekly, expandLast );

wh_falling = TimeFrameExpand( wh_falling, inWeekly, expandLast);

wh_none = TimeFrameExpand( wh_none, inWeekly, expandLast);

mh_rising = TimeFrameExpand(mh_rising, inMonthly, expandLast);

mh_falling = TimeFrameExpand(mh_falling, inMonthly, expandLast);

kol = IIf( wh_rising, colorBrightGreen, IIf(wh_falling, colorRed, IIf(wh_none, colorCustom11, colorLightGrey)));

mkol = IIf( mh_rising, colorBlue, IIf(mh_falling, colorRed, colorLightGrey));

if (Plot_fashion == 1)

{

}

else

{

bar_kol = IIf(impulse_UP, colorBrightGreen, IIf(impulse_Down, colorRed, colorCustom11));

}

Impulse_State = WriteIf(Impulse_Up, "Bulllish", WriteIf(Impulse_Down, "Bearish", "Neutral"));

GfxTextOut( "IMPULSE STATE = " +Impulse_State, textoffset + 0, 30 );

// Set the background color for Impulse Status Column

Impulse_Col = IIf(Impulse_Up, colorGreen, IIf(Impulse_Down, colorRed, colorGrey40));

bars_in_bull = Min(BarsSince(impulse_none), BarsSince(impulse_down));

bars_in_bear = Min(BarsSince(impulse_up), BarsSince(impulse_none));

bars_in_neut = Min(BarsSince(impulse_down), BarsSince(impulse_up));

// Set a single variable to show number of bars in current state depending upon

// actual Impulse Status - Bullish, Bearish or Neutral

bars_in_state = IIf(Impulse_Up, bars_in_bull, IIf(Impulse_down, bars_in_bear, bars_in_neut));

//weekly pivot

k1=-1;

SetChartBkColor(16 ) ;

k=IIf(ParamList("select type","daily|next day")=="daily",-1,0);

k1=-1;

TimeFrameSet(inDaily);

day_h= LastValue(Ref(H,K));

day_l= LastValue(Ref(L,K));

day_c= LastValue(Ref(C,K));

TimeFrameRestore();

// day

WriteVal( StochK(39) - StochK(12) );

GfxSelectFont("Arial", 8 );

_SECTION_END();

Thanks once again...

 
rpasupathy:
HI Mladen,

I am going to ask you a big favour ..... Can you please change this code to Mt4 indicator ..... Its written in Amibroker language ...

Can you please help me .... It can be changed to Blue, Red, and neutral color grey in histogram version.

Thanks a lot.

*************************************************************

_SECTION_BEGIN("Elder Impulse");

radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius

textoffset = 0.1 * radius;

GfxSelectFont("Arial", 9, 500, True );

///////////////////////////////////////////////////

SetChartOptions(0,chartShowArrows|chartShowDates);

EnableTextOutput(False);

// User-defined parameter for EMA periods

EMA_Type = Param("EMA-1, TEMA-2, JMA-3", 2, 1, 3, 1);

EMA_prds = Param("EMA_periods", 7, 1, 30, 1);

Std_MACD = Param("Standard MACD? No-0, Yes-1", 1, 0, 1, 1);

Plot_fashion = Param("Bar+Arrows-1, Impulse Bars-2", 2, 1, 2, 1);

// Allow user to define Weekly and Monthly Ribbon Location and Height

WR_P1 = Param("Weekly Ribbon Location", 5.2, -1000, 1000, 0.1);

WR_P2 = Param("Weekly Ribbon Height", 199, -0.001, 500, 0.1);

// Compute EMA and MACD Histogram

if(EMA_Type == 1)

{

DayEMA = EMA(Close, EMA_prds);

}

if (EMA_Type == 2)

{

DayEMA = TEMA(Close, EMA_prds);

}

Histogram = MACD() - Signal();

// Determine if we have an Impulse UP, DOWN or None

Impulse_Up = DayEMA > Ref(DayEMA, -1) AND Histogram > Ref(Histogram, -1);

Impulse_Down = DayEMA < Ref(DayEMA, -1) AND Histogram < Ref(Histogram, -1);

Impulse_None = (NOT Impulse_UP) AND (NOT Impulse_Down);

// Compute Weekly MACD and determine whether rising or falling

TimeFrameSet(inWeekly);

if (Std_MACD == 0)

{

MACD_val = MACD(5, Cool);

Signal_val = Signal(5, 8, 5);

}

else

{

MACD_val = MACD(12, 26);

Signal_val = Signal(12, 26, 9);

}

Hist_in_w = MACD_val - Signal_val;

wh_rising = Hist_in_w > Ref(Hist_in_w, -1);

wh_falling = Hist_in_w < Ref(Hist_in_w, -1);

wh_none = (NOT wh_rising) AND (NOT wh_falling);

TimeFrameRestore();

// Now get Monthly MACD Histogram....

TimeFrameSet(inMonthly);

MACD_val = MACD(5, 8);

Signal_val = Signal(5, 8, 5);

Hist_in_m = MACD_val - Signal_val;

mh_rising = Hist_in_m > Ref(Hist_in_m, -1);

mh_falling = Hist_in_m < Ref(Hist_in_m, -1);

TimeFrameRestore();

wh_rising = TimeFrameExpand( wh_rising, inWeekly, expandLast );

wh_falling = TimeFrameExpand( wh_falling, inWeekly, expandLast);

wh_none = TimeFrameExpand( wh_none, inWeekly, expandLast);

mh_rising = TimeFrameExpand(mh_rising, inMonthly, expandLast);

mh_falling = TimeFrameExpand(mh_falling, inMonthly, expandLast);

kol = IIf( wh_rising, colorBrightGreen, IIf(wh_falling, colorRed, IIf(wh_none, colorCustom11, colorLightGrey)));

mkol = IIf( mh_rising, colorBlue, IIf(mh_falling, colorRed, colorLightGrey));

if (Plot_fashion == 1)

{

}

else

{

bar_kol = IIf(impulse_UP, colorBrightGreen, IIf(impulse_Down, colorRed, colorCustom11));

}

Impulse_State = WriteIf(Impulse_Up, "Bulllish", WriteIf(Impulse_Down, "Bearish", "Neutral"));

GfxTextOut( "IMPULSE STATE = " +Impulse_State, textoffset + 0, 30 );

// Set the background color for Impulse Status Column

Impulse_Col = IIf(Impulse_Up, colorGreen, IIf(Impulse_Down, colorRed, colorGrey40));

bars_in_bull = Min(BarsSince(impulse_none), BarsSince(impulse_down));

bars_in_bear = Min(BarsSince(impulse_up), BarsSince(impulse_none));

bars_in_neut = Min(BarsSince(impulse_down), BarsSince(impulse_up));

// Set a single variable to show number of bars in current state depending upon

// actual Impulse Status - Bullish, Bearish or Neutral

bars_in_state = IIf(Impulse_Up, bars_in_bull, IIf(Impulse_down, bars_in_bear, bars_in_neut));

//weekly pivot

k1=-1;

SetChartBkColor(16 ) ;

k=IIf(ParamList("select type","daily|next day")=="daily",-1,0);

k1=-1;

TimeFrameSet(inDaily);

day_h= LastValue(Ref(H,K));

day_l= LastValue(Ref(L,K));

day_c= LastValue(Ref(C,K));

TimeFrameRestore();

// day

WriteVal( StochK(39) - StochK(12) );

GfxSelectFont("Arial", 8 );

_SECTION_END();

Thanks once again...

One version of elder impulse you can find here : https://www.mql5.com/en/forum/178416/page20

Or you can go through this list : Elder impluse since there are already quite a few version of that indicator

 
marley60:
hello, what do I have to add to the indicator code, if I want to see the price that triggered the alarm in the alarm window?

sorry, maybe alarm is not english and it should reed "alert".

or did I do anything wrong, because the last few times I asked something I didn´t receive any answers?

 
marley60:
sorry, maybe alarm is not english and it should reed "alert". or did I do anything wrong, because the last few times I asked something I didn´t receive any answers?

Add something like DoubleToStr(PriceThatTriggered,_Digits) to the Alert(alertText1,alertText2,...)

 

Hello,

I am trying to make an indicator that is based on the high, low, and close of another indicator. The close data is naturally available but how do i capture the highest and lowest value that the indicator has made during a specific bar? I've already looked on the internet and found functions like iHigh() and iHighest() but those seem to only allow parameters like NULL (current symbol). There seems to be something like OnCalculate() too but i'm not sure if the parameters high[], low[] etc give the high of the indicator or the symbol. Could someone please tell me if mt4 has a way to measure the high and low of the indicator data?

Kind regards,

 
mrcodix:
Hello,

I am trying to make an indicator that is based on the high, low, and close of another indicator. The close data is naturally available but how do i capture the highest and lowest value that the indicator has made during a specific bar? I've already looked on the internet and found functions like iHigh() and iHighest() but those seem to only allow parameters like NULL (current symbol). There seems to be something like OnCalculate() too but i'm not sure if the parameters high[], low[] etc give the high of the indicator or the symbol. Could someone please tell me if mt4 has a way to measure the high and low of the indicator data?

Kind regards,

high[] and low[] are giving the high prices and low prices

You have to use ArrayMaximum() and ArrayMinimum() to find the highest and lowest value of some indicator (first you have to store the values of the indicator in a buffer)

 
mladen:
high[] and low[] are giving the high prices and low prices You have to use ArrayMaximum() and ArrayMinimum() to find the highest and lowest value of some indicator (first you have to store the values of the indicator in a buffer)

Hi mladen,

Does ArrayMaximum() store the maximum value per bar or the maximum value of the entire array? Because i need the maximum and minimum value for each successive bar or element in the array.

Kind regards,

 

Hello,

ArrayMaximum - MQL4 Documentation

I've looked it up and it seems that this function returns the highest value of all the values in the array. What I am looking for is a function that tells you the highest value an indicator reached within one timeframe bar. How can i record this? So for example indicator X is forming the most recent bar. It goes from 3 to 5 to 4 to 7 and then when the time frame bar closes it finishes at value 2. The highest value it reached was 7. How can i record this value?

Reason: