Help to identify peak and trough in a indicator

casoni

Well-Known Member
#11
Hello ,
if i understood your requirement , is this you want ?

please check this

per=Optimize("Period",Param("Period",14,2,20,1),2,20,1);
percentchange=Optimize("Zig %",Param("Zig %",2,1,20,1),1,20,1);
az= RSI(per);
Plot( az,"",colorWhite,4);
ZZ = Zig(az,LastValue(PercentChange)) ;
Plot(zz,"",4,1);

this plots zz on rsi . and same zz can be applied on price chart
Thank you
 
#12
HI Casoni,
thanks to your reply. I suppose that you are italian too like me. :)
My difficulty is to plot a peak of a zig formula. See the picture example in the previous page taken from metastock. I can't create the last formula in amibroker: according to this I need value 1 whenever zig of the zigzag in the middle has a peak and value 0 whenever there is no one.
Is there anyone able to help me? regards
 
Last edited:
#13
I merely show you the concept, not the exact function here, i did not verify in the amibroker, if i verified, i likely will enclosed in the
Code:
.
Whether syntax 'chance' or 'change' is not the issue. they are just function parameter. 

the last peak formula returns error 31 syntax error, unespected ';', expecting ')' or ',' :( is very easy, it told you what the cause.
you need to patiently figure out and correct it. 

You are suppose to solve your problem, not me. I merely provide some help to you.
If you face problem and just give up and throw the problem to me. then i quit.

Come this stage, 99% of the problem had surfaced up because you think amibroker should follow what metastock is doing.
What you need is just a little push to yourself to complete the job.[/QUOTE]

Kelvin I will not give up thanks to your suggestions :thumb:
 

hmsanil

Active Member
#17
here is the code of the zig formula.

a = C-2*Ref(H,-1) + Ref(L,-2);
s = V*(C-Ref(H,-1));
q=a+s;
zigq=Zig(q,10);
Plot(Zigq,"zigq",colorWhite);

I tried to overlay this on price, but it not displaying properly.

How to overlay this indicator on price, can anybody please tell me how to do it

Thanks
 

casoni

Well-Known Member
#18
hello giuditta ,
are you looking for something like this ?

i have plotted peak-bottom on your indicator ,

please check , if this helps i will post the code.

* this is 60 min chart

thank you
 
Last edited:

KelvinHand

Well-Known Member
#19
I tried to overlay this on price, but it not displaying properly.

How to overlay this indicator on price, can anybody please tell me how to do it

Thanks
First thing, when you plot as indicator (means no price chart), what is the value shown on the Y-Axis ?

Does it tally with the price chart value ?
if not why ?
cause there is a Volume play in the formula.


To display the price chart and the non-tally indicator together, do the following:

Plot(Zigq,"zigq",colorWhite, styleOwnScale);
 

KelvinHand

Well-Known Member
#20
here is the code of the zig formula.

a = C-2*Ref(H,-1) + Ref(L,-2);
s = V*(C-Ref(H,-1));
q=a+s;
zigq=Zig(q,10);
Plot(Zigq,"zigq",colorWhite);
Now you show out "My Formula", now i understand why you failed.
Since your are laying out your Ami Code, by extracting from your previous explanation,
Hope the following is what your are trying to do:

Code:
//--1st indicator
Change1=10;
function First_Indicator()
{
  a = C-2*Ref(H,-1) + Ref(L,-2);
  s = V*(C-Ref(H,-1));
  q = a+s; 

  zigq=Zig(q,Change1);

  return q;
} 


Zig_Fml1=First_Indicator();
Plot(Zig_Fml1,"zig1",colorWhite, styleOwnScale);


//-- 2nd Indicator
percdiff = 1; 
pkd = Peak(Zig_Fml1,percdiff) == High; 
Plot(pkd, "my zig peak",colorYellow,styleOwnScale);
If i m not wrong, the problem you had faced:
1. You try to plot on price chart, nothing shown.
2. Your formula contain volume.
3. When you try to plot the following it will never work, it always default to 0.
* pkd = Peak(Zig_Fml1,percdiff) == High;

Why ?
Because your formula contains item 2, no longer able to equal to High.


IF (your script work on matastock AND don't work on Amibroker) THEN
post the original mestastock with your actual picture;
ELSE
i think i got no way to do it.
 
Last edited:

Similar threads