AmiBroker formula Language

#51
Hello Praveen

Thanks for your guidance. I will be thankful to you if you solve my one problem.

When I plot Moving Averages on Candle stick chart, they are plotted behind the candles which creates problem to observe crossover, if it is behind the candle. How to bring them forward, in front of candle?

Thanks

Sudesh
 
#52
Hello Praveen

Thanks for your guidance. I will be thankful to you if you solve my one problem.

When I plot Moving Averages on Candle stick chart, they are plotted behind the candles which creates problem to observe crossover, if it is behind the candle. How to bring them forward, in front of candle?

Thanks

Sudesh
Edit your code, and change the sequence of plot order, first plot your moving averages then plot candle
 
#54
Hello Friends,

Is it possible to build a High-Low Zig Zag in with AFL. High-Low Zig Zag focuses two series of data, High and Low i.e if we want to plot H-L Zig Zag of 5% reversal then if trend is up on 5% Zig Zag then Zig Zag uses High data. When High falls below reversal value Zig Zag uses Low data. When low moves higher than reversal value Zig Zag uses High data and so on.

If we want to calculate H-L Zig Zag Reversal of 5% then, if the trend is up, reduce 5% from high to arrive at reversal value. The reversal value will change on new highs. So reduce 5% form new high to get new reversal value.

The reversal value will remain same if the price fluctuates between the new High and the Reversal Value.

The trend will turn bearish if High moves below Reversal Value.

When trend is bullish we track High series of data e.g. if High is 100 then 5% reduced of the high is Rs.95, which is our Reversal Value . Next day if high goes above 100 say 110 Reversal Value changes to 5.5 (110-5) if next high remains below 100 Reversal Value remains same and our trend remains bullish till high falls below Reversal Value. As soon as High falls below Reversal Value trend changes from bullish to bearish and Reversal Value is calculated with help of Lows.

When trend is bearish we track Low series of data e.g. if Low is 90 the add 5% to Low to get Reversal Value i.e. 4.5. The reversal Value will change on new Low. If next day low falls below 90 Add 5% to Low to get new Reversal Value.

Reversal Value will remain same till price fluctuates between Lowest Low point and Reversal Value.

Now trend will Turn Bullish when Low moves above Reversal Value.

When Trend turns Bullish we can go Long and when Trend turns Bearish we can go Short this works well on Nifty.

Is it possible to build this system in AFL. I will be thankful if any body can help to write code for this. I have done this in excel sheet and attached herewith.


Sudesh
 

SGM

Active Member
#55
Hello Friends,

Is it possible to build a High-Low Zig Zag in with AFL. High-Low Zig Zag focuses two series of data, High and Low i.e if we want to plot H-L Zig Zag of 5% reversal then if trend is up on 5% Zig Zag then Zig Zag uses High data. When High falls below reversal value Zig Zag uses Low data. When low moves higher than reversal value Zig Zag uses High data and so on.

If we want to calculate H-L Zig Zag Reversal of 5% then, if the trend is up, reduce 5% from high to arrive at reversal value. The reversal value will change on new highs. So reduce 5% form new high to get new reversal value.

The reversal value will remain same if the price fluctuates between the new High and the Reversal Value.

The trend will turn bearish if High moves below Reversal Value.

When trend is bullish we track High series of data e.g. if High is 100 then 5% reduced of the high is Rs.95, which is our Reversal Value . Next day if high goes above 100 say 110 Reversal Value changes to 5.5 (110-5) if next high remains below 100 Reversal Value remains same and our trend remains bullish till high falls below Reversal Value. As soon as High falls below Reversal Value trend changes from bullish to bearish and Reversal Value is calculated with help of Lows.

When trend is bearish we track Low series of data e.g. if Low is 90 the add 5% to Low to get Reversal Value i.e. 4.5. The reversal Value will change on new Low. If next day low falls below 90 Add 5% to Low to get new Reversal Value.

Reversal Value will remain same till price fluctuates between Lowest Low point and Reversal Value.

Now trend will Turn Bullish when Low moves above Reversal Value.

When Trend turns Bullish we can go Long and when Trend turns Bearish we can go Short this works well on Nifty.

Is it possible to build this system in AFL. I will be thankful if any body can help to write code for this. I have done this in excel sheet and attached herewith.


Sudesh
Hello Sudesh

Find attached afl (rename the txt extention). Please note that it is an attempt by a novice, and do verify if it is what you want.

Hope you find it useful. If you need any changes or enhancements do let me know, I can just promise an attempt.

Regards
Sanjay

PS: Attaching one more version using HHV/LLV instead of Peak and Trough functions. Gives out a nice graph, but do not use the afl for buy/sell signals just yet, seems to be some problem with the code. Will upload another version tonight
 

Attachments

Last edited:
#56
Hello Sanjay

Thank you very much for code. You have done realy a nice job. First two codes are working fine but I can not understand the 3rd code ie. ZigZag Peak. HHV/LLV is working much better than Peak Trough.

What you have done is excellent and very useful.

Thanks
Sudesh
 

SGM

Active Member
#57
Hello Sanjay
First two codes are working fine but I can not understand the 3rd code ie. ZigZag Peak. HHV/LLV is working much better than Peak Trough.
Dear Sudesh

Just ignore the ZigZag Peak/Trough code alltogether. The first version of HHV/LLV was also quite crude, I uploded it to verify if that is what you want. Here's a improved version with High and Low Reverals plotted.

There are 2 more conditions i.e 1. when both the signals are True and 2. when both are False, i have indicated them on the charts with clouds, lightgrey is when none of the high or low values are in 5% zone (here the color of graph also changes to black), and bright green cloud is when both of them are in in 5% zone (here the color of graph continues to be blue).

The % for reversal is selectable for both high and low.

The no of bars for scanning the High/Low is set to be default 22 bars (aprox 1 month on EoD) this is also made selectable.

All parameters are seperate for high and low.

Spend some time on adjusting the parameters and please let me know which are the best settings for them.

Hope the afl is useful to you.

Regards
Sanjay
 
#58
hi guys,
just to help the members.
There is a site called "Amibroker fans" (same one where some guy was palming off Karthik's Indicators as his own)
well this site has all the Amibroker Library afls as a single .rar file. (will save pain of indivdually downloading every single one )
try it if anyone is so inclined
cheers
 
#59
hi guys,
just to help the members.
There is a site called "Amibroker fans" (same one where some guy was palming off Karthik's Indicators as his own)
well this site has all the Amibroker Library afls as a single .rar file. (will save pain of indivdually downloading every single one )
try it if anyone is so inclined
cheers
hellow dear rosh

what is the exact adress of this site?
 
#60
Thanks for your input,

I however think that Amiroker should have had a proper manual for AFL rather than leaving us nonprogrammers to figureout what te hell does this code mean.

Regards,

HM
 

Similar threads