Hello Comrades, Gurus & Experts,
I am a complete newbie for both trading and afl programming.
I am trying to work on a simple strategy based on afl. And it is working with reasonable results. Below is the afl. Now can some gurus & experts help me add few conditions to this so tha we can prevent false signals.
Below conditions needs to be added:
1. Buy signal should be triggered only if the difference between the last sell signal bar and the lowest low of any bar previously is atleast 1%
2. vice-versa to point 1. That is Sell signal should be triggered only if difference between the last buy signal and the highest high of any bar previously is atleast 1%
I am a complete newbie for both trading and afl programming.
I am trying to work on a simple strategy based on afl. And it is working with reasonable results. Below is the afl. Now can some gurus & experts help me add few conditions to this so tha we can prevent false signals.
Below conditions needs to be added:
1. Buy signal should be triggered only if the difference between the last sell signal bar and the lowest low of any bar previously is atleast 1%
2. vice-versa to point 1. That is Sell signal should be triggered only if difference between the last buy signal and the highest high of any bar previously is atleast 1%
Code:
_SECTION_BEGIN("RSI");
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 14, 1, 200, 1 );
Plot( EMA(RSI( periods),2), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("EMA14");
P = ParamField("Price field",-1);
Periods = Param("Periods", 14, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("BUYSELL");
a = RSI(14);
b = EMA(RSI(14),14);
Buy=Cross(a,b);
PlotShapes(shapeUpArrow*Buy,colorGreen);
AlertIf( Buy, "SOUND C:\\Windows\\Media\\tada.wav", "Audio alert", 1 );
Sell=Cross(b,a);
PlotShapes(shapeDownArrow*Sell,colorRed);
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ring09.wav", "Audio alert", 2 );
_SECTION_END();
Strategy with Potential
Aucun commentaire:
Enregistrer un commentaire