Loading Support and resistance from csv to amibroker

Hi,

I want to use support resistance at daily level in my code for intraday.

I am using peak amd trough to calculate then. There are two issues I need to solve.

1.) Peak asks for a single array so I can use only High and % Change is calculated form higher to lower high whereas I want to calculate it from High to low. I have used certain platforms where zig zag plots it from high to low rather then high to high. Any help how to solve it.

2.) Calculating this is taking >5 minutes (increased from 20second minutes) for single scan as I need to load 6 months of data else 10 days would suffice for me. This isnt feasible for intraday. Is it possible that I calculate them beforehand .. load them to amibroker and use this loaded data to use in my code.

Any help on any of above points is highly appreciated.

Regards,
Chirah

As for the 1st request ,

You can either identify the high and low through writing down some conditions and then use iif() function to create an array composed of mixed highs and lows which would be used as an input to your Zig() function

OR

You can use something similar to the below code , it would give you a very quick result however it lacks accuracy

Percentage = Param("Percentage Change",5,1,100);


Zz  = Zig(High,Percentage);
MA0 = Mixed_Array = IIf(ROC(Zz,1) > 0,High,Low);
Zz  = Zig(MA0,Percentage);


Plot(Close,"Close",colorDefault,styleBar);
Plot(Zz,"Zz",colorWhite,styleNoRescale);

As for the 2nd request ,

You need to store the result using one of the following methods

1 - First is to use static functions such as StaticVarSet & StaticVarGet

StaticVarSet() offer you to store the calculated values into memory which you can retrieve it back with no need to make your calculations again , these values that you allocated previously to memory can be kept in a file called "PersistVars.bin " , you can enable this feature through the 3rd argument , when you launch Amibroker again these values would be retrieved automatically to your chart with no need to calculate it again

2 - Second is to use file handle functions such as fopen() ,fputs() , fgets() and fmkdir , you can find some useful applications and examples in KB such as this one

You can try both solution but i think the first approach is much favorable over the second for its simplicity and also for being much more faster

1 Like