Amibroker

Hello everyone,

I was hoping if someone with knowledge in Ami-broker can please help me.

I am simply trying to create a BUY signal when the current bar CLOSES 50% or below from the previous bar.


I thought maybe averaging out the previous bar might work but I'm so lost. hoping someone can help please.

Buy = Ref ((h - l)/ L ,-1)*100;
 
https://forum.amibroker.com/

You’ll find quicker help there however your question is a bit confusing to me. 50 percent of what? The close? The previous bars range?

Also “buy” will accept Boolean statement so true/false ( 1 or O).

On my phone here so this is just pseudo code, you’d want something like

Buy = C <= ( your variable here)
 
yes.. that Buy resolves to a scalar not a boolean. If IBM hi/lo is 50,49... then your statement is
buy = ((50-49)/49)*100
buy = (1/49)*100 = 2.04
I assume you wanna do something like moving avg. so you need to create a cus indicator then do something like
buy =( ma_10day )> ref(close,-1) this resolves to a 0 or 1.Ami is an amazing prod BUT has a steep learning curve.
 
Hello, thank-you for the insight. But it still won't work sorry.
I tried buy = C < Ref((H - L)/2, -1) ;

I uploaded image showing the problem. Thank-you for helping.
 

Attachments

  • amibroker.jpg
    amibroker.jpg
    141.3 KB · Views: 26
Sure theirs a prettier way to do this but try

C<= ref(((H-L)/2)+L,-1).

This will give you the value at halfway through the previous bar. Your code gives you half the bars value.
 
wajo.. this wont work.. bec in my pseudoexample that equation resolves to $2.4 and if IBM is 50 then your equation is buy= 50 < $2.04.
 
Hello everyone,
I was hoping if someone with knowledge in Ami-broker can please help me.
I am simply trying to create a BUY signal when the current bar CLOSES 50% or below from the previous bar.
I thought maybe averaging out the previous bar might work but I'm so lost. hoping someone can help please.
Buy = Ref ((h - l)/ L ,-1)*100;
My experience, you are probably best to break your formulas down to several lines rather than place them in one line, then add a descriptor at the end so it jogs your memory later on.
First, what is bar height.
Second, 50% of bar height
Then the buy signal line.
Eg
BH1 = H-L; // Bar height
BH2 = BH1*0.5; // 50% of barheight
BH3 = ref(BH2,-1); // 50% of previous bar height
BH4 = Buy =C< BH3; // Buy on 50% of previous bar
Something like that.....
 
Back
Top