Hello
I am trying to bild a counter to determine when the bad trades are made.
I started to evaluate wich day of the week, but its count wrong.
Here is an snippet from the code
if buycondition then
buy positionsize contract at market
tradecounterall=tradecounterall+1
Trigger = 1 //Trigger that a new position are open so you evalute the last one
endif
Once TradeCounterall =0
Once Trigger = 0
Once BadMondag=0
Once BadTisdag=0
Once BadOnsdag=0
Once BadTorsdag=0
Once BadFredag=0
if Trigger = 1 then
if PositionPerf(1)< 0.0 then //If the last position whas bad count the day that trade whas made
if currentday =1 then
BadMondag=BadMondag+1
elsif currentday=2 then
BadTisdag=BadTisdag+1
elsif currentday=3 then
BadOnsdag=BadOnsdag+1
elsif Currentday=4 then
BadTorsdag=BadTorsdag+1
elsif Currentday=5 then
BadFredag=BadFredag+1
endif
currentday=Currentdayofweek //Set th current day for next trade
Trigger=0
endif
graphonprice tradecounterall coloured(0,0,255,255) as “tradecounter”
graphonprice BadMondag coloured(0,0,255,255) as “Mondag”
graphonprice BadTisdag coloured(0,0,255,255) as “Tisdag”
graphonprice BadOnsdag coloured(0,0,255,255) as “Onsdag”
graphonprice BadTorsdag coloured(0,0,255,255) as “Torsdag”
graphonprice BadFredag coloured(0,0,255,255) as “Fredag”
In the backtest I do, the calculator in the grah, for example tradecounterall, says that there have been 215 trades, and if I add upp all the bad days, it might be say 65pcs. But when I read the same values from the Detailed report it shows other numbers. Let say Totalt: 150, Losing:50.
What is wrong or can anyone suggest another way to do this?