Coding help - page 331

 

Coding help

Good afternoon everyone

Hello mladen

I'm trying to find this code to MT4 and can not find it

The indicator is called Magarto.

I have the code for another platform

  1. study("magarto indicator",overlay=false)
  2. ma=sma(close,30)

    maslope=ma-ma[2]

    maslopeB=iff(maslope0,1,0))

    candleOver=iff(ohlc4>ma,1,-1)

    xMA = ema(close,13)

    DayLow = iff(dayofmonth != dayofmonth[1], low, min(low, nz(DayLow[1])))

    bearpower = DayLow - xMA

    DayHigh = iff(dayofmonth != dayofmonth[1], high, max(high, nz(DayHigh[1])))

    bullpower = DayHigh - xMA

    bothElder=iff((bearpower>0 and bullpower>0),1,iff((bearpower<0 and bullpower<0),-1,0))

    all4=maslopeB+candleOver+bothElder

    plot(all4)

    hline(3)

    hline(-3)

    sell = all4 == -3 ? all4 : na

    buy = all4 == 3 ? all4 : na

    plot(sell, style=circles, linewidth=4, color=red)

    plot(buy, style=circles, linewidth=4, color=green)

I could help you find it.

I'm seeing this other indicator, it has something to do with the code Magarto.

https://www.mql5.com/en/forum/173112/page2

Thank you very much in advance.

A greeting.

Files:
magarto.png  70 kb
 

Sorry to bother again...

yesterday i have modified a lot of indicators of mine in order to limit bars calculation to save some cpu since i run multiple mt4 concurrently.

The code i used for this purpose is this:

int start()

{

int i,limit,counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

limit=Nbars-counted_bars;

but i'm just noting that now, with markets open, all modified indicators don't update itself when new bars are plotted on screen.

Is it possible for you, experienced coders, find the problem just in those few lines? Or better, is there a way or a formula that can be used in all indicators in order to limiting bars calculation?

 
thefxpros:
Sorry to bother again...

yesterday i have modified a lot of indicators of mine in order to limit bars calculation to save some cpu since i run multiple mt4 concurrently.

The code i used for this purpose is this:

int start()

{

int i,limit,counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

limit=Nbars-counted_bars;

but i'm just noting that now, with markets open, all modified indicators don't update itself when new bars are plotted on screen.

Is it possible for you, experienced coders, find the problem just in those few lines? Or better, is it a way or a formula that can be used in all indicators in order to limiting bars calculation?

Replace that last line with the following and all cases should be "covered":

if (Nbars<=0) Nbars = Bars-1;

limit=MathMin(MathMin(Bars-counted_bars,Bars-1),Nbars);

 
mladen:
Replace that last line with the following and all cases should be "covered":

if (Nbars<=0) Nbars = Bars-1;

limit=MathMin(MathMin(Bars-counted_bars,Bars-1),Nbars);

you saved me.

thanks, all works fine.

 

Hi mladen, can you help me to translate this code for mt4? thanks

_SECTION_BEGIN("TD Pressure Ratio");

SetChartBkColor(16);

Periods = Param("Periods",13,1,50,1);

function TDPressure (Periods)

{

for( i = 2; i < BarCount; i++ )

{

if((O - C) / C > 0.15) // gapup

{

BP = (H - C + C - L) * V;

}

else if((C-O) / O > 0.15)// gapdown

{

SP = (C - L + H - C) * V;

}

else

{

BP = IIf(C > O, C - O,0) * V;

SP = IIf(C < O, C - O,0) * V;

}

}

Result = 100 *Sum(BP,Periods)/ (Sum(BP,Periods) -

Sum(SP,Periods));

Result = IIf(Result < 0,0,Result);

Result = IIf(Result > 100,100,Result);

return Result;

}

TDP = TDPressure(Periods);

Plot(TDP ,"TD Pressure",colorLightBlue,1);

Plot( 25 , "", colorGreen,styleDashed);

Plot( 50 , "", colorLightGrey,styleDashed);

Plot( 75 , "", colorRed,styleDashed);

_SECTION_END();

 

Hi All,

If this isn't the correct thread for this, please direct me to the proper place.

This is my favorite indicator and the alerts are great, but it alerts during the current candle whenever the signal changes. This results in a lot of false signals as only the shadow of the candle goes above/below the band and the direction is not officially changed.

Is it possible to alter the code so that it will only send the alert once the direction has changed AND the bar has closed?

Thanks!

 
sundown858:
Hi All,

If this isn't the correct thread for this, please direct me to the proper place.

This is my favorite indicator and the alerts are great, but it alerts during the current candle whenever the signal changes. This results in a lot of false signals as only the shadow of the candle goes above/below the band and the direction is not officially changed.

Is it possible to alter the code so that it will only send the alert once the direction has changed AND the bar has closed?

Thanks!

sundown858

set the alertsOnCurrent to false and that should do it

 

Did you try switch "false" that option?

extern bool alertsOnCurrent = true;

 
Hermo:
Good afternoon everyone

Hello mladen

I'm trying to find this code to MT4 and can not find it

The indicator is called Magarto.

I have the code for another platform

  1. study("magarto indicator",overlay=false)
  2. ma=sma(close,30)

    maslope=ma-ma[2]

    maslopeB=iff(maslope0,1,0))

    candleOver=iff(ohlc4>ma,1,-1)

    xMA = ema(close,13)

    DayLow = iff(dayofmonth != dayofmonth[1], low, min(low, nz(DayLow[1])))

    bearpower = DayLow - xMA

    DayHigh = iff(dayofmonth != dayofmonth[1], high, max(high, nz(DayHigh[1])))

    bullpower = DayHigh - xMA

    bothElder=iff((bearpower>0 and bullpower>0),1,iff((bearpower<0 and bullpower<0),-1,0))

    all4=maslopeB+candleOver+bothElder

    plot(all4)

    hline(3)

    hline(-3)

    sell = all4 == -3 ? all4 : na

    buy = all4 == 3 ? all4 : na

    plot(sell, style=circles, linewidth=4, color=red)

    plot(buy, style=circles, linewidth=4, color=green)

I could help you find it.

I'm seeing this other indicator, it has something to do with the code Magarto.

https://www.mql5.com/en/forum/173112/page2

Thank you very much in advance.

A greeting.

What trading platform coding language is that?

 

My goodness! I was wondering what that input did. That solved it. Thanks mladen and assassin!

Reason: