+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

Daily Performance Your Buy Signal

Evaluate the performance of your buy signals with the Daily Performance Your Buy Signal AFL for Amibroker. This insightful tool, available for free download, utilizes the Amibroker data feed to analyze the effectiveness of your buy signals on a daily basis. Whether you’re refining your strategy or assessing historical performance, this AFL empowers traders to make data-driven decisions. Incorporate the Daily Performance Your Buy Signal AFL into your toolkit to enhance your understanding of buy signal dynamics and optimize your trading approach.

/
_SECTION_BEGIN("Daily Performance Check of your Buy signal");
/*
A Daily Performance Check of your Buy signal.  Corrected and revised on 7/14/01.
Use to:
1.  Help set Stop Losses, in percentages.
2.  See if increase in rate of return levels off within the first 20 days.
3.  See if signal is a "leading" indicator, and by how many days.
This is a different way to look at the performance of a buy signal - it is a day - by - day look at percentage gain for 20 days.  
For this example, "Buffy Averages"  was used.  
Replace the Buffy Averages with your system, and you can see how your system performs.
--------------------------How to Use--Modified 7/14/01-------------------------
After running "Explore", Expand the columns Max... and Min... to
MaxGain and MinGain.  MaxGain is the Maximum Gain realized for 20 days.  The first column after MaxGain ( +Day) is the day after
the signal where the max gain occured. MinimumGain and -Day works the same way.  These four columns give a quick summary of the results of explore.
After running the test on a the current stock, scroll to the right and select the "D20%" column.  Sort so blue arrow points up.  This gives you the best gains for 20 days for this buy signal.
Now as you scan slowly back towards "D1%" with this sort still in place, you can see the maximum percent loss your system used to get the desired gains.  This maximum percent loss can be used in the "Settings" button for Backtesting your system.
"D20%" was used in this example, but any of the "Dn%" columns can be used for sorting.  If you are a swing trader using a maximum time frame of only 2 or 3 days in your system, use "D2%" or "D3%".
A careful study of the results might reveal that possibly, for example, the rate of change of percentage gains slows down after day five.  This would prepare you to exit on day five.
Another possible finding is that the signal is "early", and best entry point might be, for example again, three days after the actual buy signal.  This would be revealed by negative returns for the first three days, and then positive gains.
*/
/*-----------Replace all until next dashed line with your system------------*/
/*-----------Ensure your "Buy" rules are included--------------------------------*/
/*
Buffy Averages
*/

FastPeriods =5;
SlowPeriods = 20;

 
FastBuffAvg = Sum( Volume * Close, FastPeriods ) / Sum( Volume, FastPeriods );
SlowBuffAvg = Sum( Volume * Close,  SlowPeriods ) / Sum( Volume, SlowPeriods );
 
Graph0 = FastBuffAvg;
Graph1 = SlowBuffAvg;


/* buy & sell trading rules */
Buy = Cross( FastBuffAvg, SlowBuffAvg );
Sell = Cross( SlowBuffAvg, FastBuffAvg );
 
/* A commentary */
buybars = BarsSince( Buy );
sellbars = BarsSince( Sell );
 
WriteIf( buybars < sellbars, 
"A bullish crossover occured " + WriteVal( buybars ) + " bars ago", 
"A bearish crossover occured " + WriteVal( sellbars ) + " bars ago" );

/*--------------------------------------------------------------------------------------------------------*/
/*  Only Buy signals will be used
"D1%" means percent gain at the end of day one, "D2%" the end of day two, etc.
The entry price will be the Open on the day following the signal.
The percent gain will be the Close price of the day.
This program looks "forward" twenty days, so under the "Range" option, use the last radio button next to "from" and set the dates that would include a stop date ("to") about 21 days ago.  Start date is your option.  If this step is NOT done, signals that occur within the last 21 days will have bad data in the display.
REMEMBER THAT THE RESULTS MEASURE PAST PERFORMANCE, AND THERE IS NO GUARENTEE THAT THE STOCK WILL HAVE THE SAME GAINS IN THE FUTURE.
*/
/*  EP is the Entry Price */
EP = Ref(O,1);
D1G = 100*(Ref(C,1) - EP)/EP;
D2G = 100*(Ref(C,2) - EP)/EP;
D3G = 100*(Ref(C,3) - EP)/EP;
D4G = 100*(Ref(C,4) - EP)/EP;
D5G = 100*(Ref(C,5) - EP)/EP;
D6G = 100*(Ref(C,6) - EP)/EP;
D7G = 100*(Ref(C,7) - EP)/EP;
D8G = 100*(Ref(C,8) - EP)/EP;
D9G = 100*(Ref(C,9) - EP)/EP;
D10G = 100*(Ref(C,10) - EP)/EP;
D11G = 100*(Ref(C,11) - EP)/EP;
D12G = 100*(Ref(C,12) - EP)/EP;
D13G = 100*(Ref(C,13) - EP)/EP;
D14G = 100*(Ref(C,14) - EP)/EP;
D15G = 100*(Ref(C,15) - EP)/EP;
D16G = 100*(Ref(C,16) - EP)/EP;
D17G = 100*(Ref(C,17) - EP)/EP;
D18G = 100*(Ref(C,18) - EP)/EP;
D19G = 100*(Ref(C,19) - EP)/EP;
D20G = 100*(Ref(C,20) - EP)/EP;
/* Compute the Maximum Gain for the 20 Days  */
Max20 = Max(D1G,D2G);
MaxCntr = IIf(D1G > D2G,1,2);
Max20 = Max(Max20,D3G);
MaxCntr = IIf(Max20 > D3G,MaxCntr,3);
Max20 = Max(Max20,D4G);
MaxCntr = IIf(Max20 > D4G,MaxCntr,4);
Max20 = Max(Max20,D5G);
MaxCntr = IIf(Max20 > D5G,MaxCntr,5);
Max20 = Max(Max20,D6G);
MaxCntr = IIf(Max20 > D6G,MaxCntr,6);
Max20 = Max(Max20,D7G);
MaxCntr = IIf(Max20 > D7G,MaxCntr,7);
Max20 = Max(Max20,D8G);
MaxCntr = IIf(Max20 > D8G,MaxCntr,8);
Max20 = Max(Max20,D9G);
MaxCntr = IIf(Max20 > D9G,MaxCntr,9);
Max20 = Max(Max20,D10G);
MaxCntr = IIf(Max20 > D10G,MaxCntr,10);
Max20 = Max(Max20,D11G);
MaxCntr = IIf(Max20 > D11G,MaxCntr,11);
Max20 = Max(Max20,D12G);
MaxCntr = IIf(Max20 > D12G,MaxCntr,12);
Max20 = Max(Max20,D13G);
MaxCntr = IIf(Max20 > D13G,MaxCntr,13);
Max20 = Max(Max20,D14G);
MaxCntr = IIf(Max20 > D14G,MaxCntr,14);
Max20 = Max(Max20,D15G);
MaxCntr = IIf(Max20 > D15G,MaxCntr,15);
Max20 = Max(Max20,D16G);
MaxCntr = IIf(Max20 > D16G,MaxCntr,16);
Max20 = Max(Max20,D17G);
MaxCntr = IIf(Max20 > D17G,MaxCntr,17);
Max20 = Max(Max20,D18G);
MaxCntr = IIf(Max20 > D18G,MaxCntr,18);
Max20 = Max(Max20,D19G);
MaxCntr = IIf(Max20 > D19G,MaxCntr,19);
Max20 = Max(Max20,D20G);
MaxCntr = IIf(Max20 > D20G,MaxCntr,20);
/*Now the Minimum Gain for the 20 Days  */
Min20 = Min(D1G,D2G);
MinCntr = IIf(D1G < D2G,1,2);
Min20 = Min(Min20,D3G);
MinCntr = IIf(Min20 < D3G,MinCntr,3);
Min20 = Min(Min20,D4G);
MinCntr = IIf(Min20< D4G,MinCntr,4);
Min20 = Min(Min20,D5G);
MinCntr = IIf(Min20 < D5G,MinCntr,5);
Min20 = Min(Min20,D6G);
MinCntr = IIf(Min20< D6G,MinCntr,6);
Min20 = Min(Min20,D7G);
MinCntr = IIf(Min20 < D7G,MinCntr,7);
Min20 = Min(Min20,D8G);
MinCntr = IIf(Min20< D8G,MinCntr,8);
Min20 = Min(Min20,D9G);
MinCntr = IIf(Min20 < D9G,MinCntr,9);
Min20 = Min(Min20,D10G);
MinCntr = IIf(Min20< D10G,MinCntr,10);
Min20 = Min(Min20,D11G);
MinCntr = IIf(Min20< D11G,MinCntr,11);
Min20 = Min(Min20,D12G);
MinCntr = IIf(Min20 < D12G,MinCntr,12);
Min20 = Min(Min20,D13G);
MinCntr = IIf(Min20 < D13G,MinCntr,13);
Min20 = Min(Min20,D14G);
MinCntr = IIf(Min20< D14G,MinCntr,14);
Min20 = Min(Min20,D15G);
MinCntr = IIf(Min20 < D15G,MinCntr,15);
Min20 = Min(Min20,D16G);
MinCntr = IIf(Min20 < D16G,MinCntr,16);
Min20 = Min(Min20,D17G);
MinCntr = IIf(Min20 < D17G,MinCntr,17);
Min20 = Min(Min20,D18G);
MinCntr = IIf(Min20 < D18G,MinCntr,18);
Min20 = Min(Min20,D19G);
MinCntr = IIf(Min20< D19G,MinCntr,19);
Min20 = Min(Min20,D20G);
MinCntr = IIf(Min20 < D20G,MinCntr,20);

NumColumns = 26;
Column0 = C;
Column0Format = 1.2;
Column0Name = "Close";
Column1 = EP;
Column1Format = 1.2;
Column1Name = "E. P.";
Column2 = Max20;
Column2Format = 1.2;
Column2Name = "MaxGain";
Column3 = MaxCntr;
Column3Format = 1.0;
Column3Name = " +Day";
Column4 = Min20;
Column4Format = 1.2;
Column4Name = "MinGain";
Column5= MinCntr;
Column5Format = 1.0;
Column5Name = "-Day";
Column6 =D1G;
Column6Format = 1.2;
Column6Name = "D1%";
Column7 =D2G;
Column7Format = 1.2;
Column7Name = "D2%";
Column8 =D3G;
Column8Format = 1.2;
Column8Name = "D3%";
Column9=D4G;
Column9Format = 1.2;
Column9Name = "D4%";
Column10 =D5G;
Column10Format = 1.2;
Column10Name = "D5%";
Column11=D6G;
Column11Format = 1.2;
Column11Name = "D6%";
Column12 =D7G;
Column12Format = 1.2;
Column12Name = "D7%";
Column13 =D8G;
Column13Format = 1.2;
Column13Name = "D8%";
Column14 =D9G;
Column14Format = 1.2;
Column14Name = "D9%";
Column15 =D10G;
Column15Format = 1.2;
Column15Name = "D10%";
Column16 =D11G;
Column16Format = 1.2;
Column16Name = "D11%";
Column17 =D12G;
Column17Format = 1.2;
Column17Name = "D12%";
Column18 =D13G;
Column18Format = 1.2;
Column18Name = "D13%";
Column19 =D14G;
Column19Format = 1.2;
Column19Name = "D14%";
Column20 =D15G;
Column20Format = 1.2;
Column20Name = "D15%";
Column21 =D16G;
Column21Format = 1.2;
Column21Name = "D16%";
Column22 =D17G;
Column22Format = 1.2;
Column22Name = "D17%";
Column23 =D18G;
Column23Format = 1.2;
Column23Name = "D18%";
Column24 =D19G;
Column24Format = 1.2;
Column24Name = "D19%";
Column25 =D20G;
Column25Format = 1.2;
Column25Name = "D20%";

Filter = Buy == 1;
_SECTION_END();

Open chat
1
Hi, how can I help you?