Hello
Iam new to back-testing in amibroker. I used to back-test in VB. Friends here tell me that it wud be much better to learn testing in AFL. Apparently, iam new to C syntax and i find it difficult to understand back-testing codes in AFL.
Just to gain more understanding, can someone plz help by writing a back-testing code for the following simple BUY/Sell argument. This shud be fairly simple for mediumly experienced in AFL coders.
For Long Trades:
SL < Ref(L,-2)
Profit = Ref(H,-2) + 0.05(entry filter) + brokerage(in terms of pts)
For Short Trades:
SL > Ref(H,-2)
Profit = Ref(L,-2) - 0.05(entry filter) - brokerage(in terms of pts)
Brokerage = Qty * entry price * 2 * 0.025%
Thanx
NTM
Iam new to back-testing in amibroker. I used to back-test in VB. Friends here tell me that it wud be much better to learn testing in AFL. Apparently, iam new to C syntax and i find it difficult to understand back-testing codes in AFL.
Just to gain more understanding, can someone plz help by writing a back-testing code for the following simple BUY/Sell argument. This shud be fairly simple for mediumly experienced in AFL coders.
local Hw;
Hw=(Ref(H,-2)+Ref(L,-2))/2; // this is entry price
Buy= Ref(C,-3)<Ref(O,-3) AND Ref(C,-2)>Ref(O,-2) AND Ref(C,-1)>Ref(O,-1) AND Ref(C,-1)>Ref(C,-2) AND L<=(Hw+0.05);
Sell=Ref(C,-3)>Ref(O,-3) AND Ref(C,-2)<Ref(O,-2) AND Ref(C,-1)<Ref(O,-1) AND Ref(C,-1)<Ref(C,-2) AND H>=(Hw-0.05);
Hw=(Ref(H,-2)+Ref(L,-2))/2; // this is entry price
Buy= Ref(C,-3)<Ref(O,-3) AND Ref(C,-2)>Ref(O,-2) AND Ref(C,-1)>Ref(O,-1) AND Ref(C,-1)>Ref(C,-2) AND L<=(Hw+0.05);
Sell=Ref(C,-3)>Ref(O,-3) AND Ref(C,-2)<Ref(O,-2) AND Ref(C,-1)<Ref(O,-1) AND Ref(C,-1)<Ref(C,-2) AND H>=(Hw-0.05);
SL < Ref(L,-2)
Profit = Ref(H,-2) + 0.05(entry filter) + brokerage(in terms of pts)
For Short Trades:
SL > Ref(H,-2)
Profit = Ref(L,-2) - 0.05(entry filter) - brokerage(in terms of pts)
Brokerage = Qty * entry price * 2 * 0.025%
Thanx
NTM