[Frustrated] Need help with AFL and analysis

#1
This is my formula (for testing and learning purpose only):

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 9, 0.01, 5, 0.01, 0 );
//Periods = Param("Periods", 9, 0.1, 10, 0.05, 0.1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

Buy = C > O AND (C - O) * 2 > H - L AND C > MA (C, 9) AND MA (C, 9) > O;
This is working fine for 'daily charts' but when I use it for 'intraday' analysis, it just doesn't work....

It is still giving daily signals only. For example if there is a trigger for ACC and I click on it, in analysis symbol list, the chart is opened in daily mode only.

I just am not able to generate signals in intraday mode. I have checked all the database and category settings and it still doesn't work.

Also, the SMA automatically gets set to default value of 15 every other time I use the above formula which is very irritating PLUS the formula considering only the daily values for analysis is even more irritating.

please help :(

I am a real noob to ami broker and I have read a lot since day before yesterday, trying to find a solution but I am running against time and haven't got anything back yet, even remotely satisfactory.

I will really appreciate senior members helping me on this issue.

Regards,
 

trash

Well-Known Member
#2
Got to backtest settings -> General tab -> Periodicity
Time frame setting for chart and backtest are independent from each other!

But both are dependent on Base time interval of File -> Database settings.

Also, the SMA automatically gets set to default value of 15 every other time I use the above formula
This is so because all analysis windows have chartid -> zero.
Parameters are dependent on chartid.

So it is advised to either use GParam functions of user knowledge base of AmiBroker or using hard coded parameter (parameters without use of param, paramlist, paramtoggle etc)
 
Last edited:
#3
I don't know how to thank you....... I did see it before while testing one of the AFLs but completely forgot about it....... so many thanks to you..... :clap::clapping::rofl::thumb:

One thing more..... Do u know how to stop ami broker from resetting custom MA values to its own default values.......

How to do this: "using hard coded parameter"

Got to backtest settings -> General tab -> Periodicity
Time frame setting for chart and backtest are independent from each other!

But both are dependent on Base time interval of File -> Database settings.



This is so because all analysis windows have chartid -> zero.
Parameters are dependent on chartid.

So it is advised to either use GParam functions of user knowledge base of AmiBroker or using hard coded parameter (parameters without use of param, paramlist, paramtoggle etc)
 

trash

Well-Known Member
#4
One thing more..... Do u know how to stop ami broker from resetting custom MA values to its own default values.......

How to do this: "using hard coded parameter"
For system design simply don't use params but i.e.

var1 = 5;
var2 = 15;

etc

here is what Tomasz says

Hello,

What you are trying to achieve is to circumvent fundamental design rule of AmiBroker:
Automatic Analysis is separate and independent from indicator, with the exception of equity chart (chartID=999) that is supposed to read automatic analysis parameters.

This is so because by design only equity chart should ever read AA parameters.

The reverse - indicator setting AA parameter is bad idea. Why? AA operation may be PENDING while you are using indicator, especially now with multithreading.

Passing parameters from indicator to AA leads inevitably to unreliable results of any automatic analysis because for example in the middle of backtest run you would be changing parameters and all results would become trash.
Don't do that.


Best regards,
Tomasz Janeczko
amibroker.com
If you still wanna control params from indicator pane then rather use gParams
https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/158412

BTW, your code of post #1 has no exit rule
 
#5
Ya that's right, my code doesn't have an exit rule yet as I am only beginning to learn AFL and my coding is rudimentary at best.....

Also, I am just a beginner with stock market too. So for now I know only one thing, where to pick up trade and exit after 2-10% profit and let the markets soar, if it does. I don't mind losing the extra profits if the markets continue to move in the profit direction.

As I read in someone's signature here, "It is better to wish to have been in a winning trade, than to wish to not to have been in a losing trade".

I will write about, how this signal works, in a separate post so that more people can benefit from it.......

For system design simply don't use params but i.e.

var1 = 5;
var2 = 15;

etc

here is what Tomasz says



If you still wanna control params from indicator pane then rather use gParams
https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/158412

BTW, your code of post #1 has no exit rule
 

Similar threads