Ocean theory based indicators - page 7

 
mladen:
kokleongch

Here you go

It is a dynamic zones version. As usual "zero line" is adjusted in this one too and I think that the greatest difference will be to see the zero line crosses (as far as I see dynamic zone is "quicker" in reacting to those, but you nigh experiment a bit with those (the lookback period))

thanks MLaden !

 

Log(x) where x<0

mladen, would you please help me solve this problem with negative values for the MathLog()? I've beat my head against the wall for almost a week. I know the problem is pal returns negative values. I wrote a routine that finds the minimum, takes the MathAbs() of that and adds it to the raw value in order to move everything > 0. But the last bar gives me fits. I'd like to see how you deal with this type problem.

There was another item I would appreciate your recommendation on - when the previous bar Low is at or near the current bar High (and vice versa) a spike results (expected and normal). Could you recommend an alternative (maybe an extern switch?) that clamps or mutes those spikes so they do not make it to the indicator presentation and affect the scale so much?

Thanks in advance.

Here's pal_ocn_nmm.mq4 and palnd_v1.59.mq4

Files:
 

...

adeo

Can you post the indicator (the working version) that was causing you a problems with MathLog()?

This way I can not tell much, except that you might save the sign, take a MathLog() of an absolute value and multiply that result with a sign (which can be +1 or -1)

adeo:
mladen, would you please help me solve this problem with negative values for the MathLog()? I've beat my head against the wall for almost a week. I know the problem is pal returns negative values. I wrote a routine that finds the minimum, takes the MathAbs() of that and adds it to the raw value in order to move everything > 0. But the last bar gives me fits. I'd like to see how you deal with this type problem.

There was another item I would appreciate your recommendation on - when the previous bar Low is at or near the current bar High (and vice versa) a spike results (expected and normal). Could you recommend an alternative (maybe an extern switch?) that clamps or mutes those spikes so they do not make it to the indicator presentation and affect the scale so much?

Thanks in advance.

Here's pal_ocn_nmm.mq4 and palnd_v1.59.mq4
 

Shift using minimum value

mladen:
adeo

Can you post the indicator (the working version) that was causing you a problems with MathLog()?

This way I can not tell much, except that you might save the sign, take a MathLog() of an absolute value and multiply that result with a sign (which can be +1 or -1)

The pal ocn nmm posted earlier IS the one causing the problem with MathLog() of negative value. If you are wanting my attempt at correcting the values, here is is pal_ocn_nmm_corr.mq4 - it has a problem too in that the last bar or two does not seem right.

Like this?

if (currPrice < 0){

swapSign = true;

currPrice = MathAbs(currPrice);

}

if (currPrice > 0)

tBuffer[r] = MathLog(currPrice);

else tBuffer[r] = 0.00;

if (swapSign == true) tBuffer[r] *= -1;

Files:
 

...

adeo

In the findMinPal() function you are using "limit" as a period to find the minimal value. That means that on a first call it will look for minimal value on all the bars, and on the second tick it will look for minimal value of just 2 or 3 last bars. That distorts the calculation significantly for those 2,3 bars. Here is one solution (it will look for minimal value only on first tick it calculates, and after that minval stays a constant) You might extend it by checking if the number of bars have changed and the re-checking the minimal value. In any case, since you use minval as a constant, it has to recalculate all the values if the minval changes. Maybe the best solution would be to set some number of bars to look for minimal value for. That way you would avoid re-calculating and it would be even a kind of an adapting indicator (just one idea)

adeo:
The pal ocn nmm posted earlier IS the one causing the problem with MathLog() of negative value. If you are wanting my attempt at correcting the values, here is is pal_ocn_nmm_corr.mq4 - it has a problem too in that the last bar or two does not seem right.

Like this?

if (currPrice < 0){

swapSign = true;

currPrice = MathAbs(currPrice);

}

if (currPrice > 0)

tBuffer[r] = MathLog(currPrice);

else tBuffer[r] = 0.00;

if (swapSign == true) tBuffer[r] *= -1;
Files:
 

...

Adeo

Did the previous post help you solve the issues you had?

 

SwapSign

mladen:
Adeo Did the previous post help you solve the issues you had?

Yes, thank you. I ended up using the swapSign approach. Did you see question on Granger?

 
mrtools:
Adeo been trying to add the slope divergence to these indicators since way back was in the middle of trying again when i saw your request, still couldn't get the mtf part done, so asked Mladen think it was less than 5 minutes he fixed them and think you will like, if you want the channels removed just set extern int LinearRegressionLength = 1, that will remove them.

Mr Tools, is it possible to draw 2 nmc on the same window with 2 different parameters ? Right now, i superimpose 2 nmc indies on the same window but i would prefer to see the same zero line. I dont really need the slope divergence.

Thanks

KL

 
kokleongch:
Mr Tools, is it possible to draw 2 nmc on the same window with 2 different parameters ? Right now, i superimpose 2 nmc indies on the same window but i would prefer to see the same zero line. I dont really need the slope divergence.

Thanks

KL

Hi KL,

Yes but on one of them just delete the zero line level, on this version wasn't sure if you were meaning mtf or not, so just made it mtf just in case, in the picture using two instances of the indicator one higher timeframe with zero level deleted, and on the regular time frame left the zero, indicator will work the same with different periods also. Is this what you had in mind?

Files:
 
mrtools:
Hi KL, Yes but on one of them just delete the zero line level, on this version wasn't sure if you were meaning mtf or not, so just made it mtf just in case, in the picture using two instances of the indicator one higher timeframe with zero level deleted, and on the regular time frame left the zero, indicator will work the same with different periods also. Is this what you had in mind?

Hi Mrtools,

What i am looking is the indie to draw 2 nmc lines based on 2 parameters of NMC period n TEMA period. I assume this will mean they will have the same base 0. it is similar to the dtsoc indie modification i requested earlier.

Thanks

KL