EMA Crossover system -- huge earning potential

msa5678

Well-Known Member
#31
Hello MSA5678,

Also, I assume that Buyminus is the way to calculate stop loss. But I could not understand Buyplus. Similarly why Sellminus?
BuyPlus, BuyMinus, SellPlus and SellMinus
are variables defined to Plot BookProfit and SL
Lines for Long and Short Positions respectively,
I have used 20 pts Book Profit and 20 pts SL in
the AFL. This can be edited as per individual need.
These lines give a visual help.


Also it would be great, if we can define a box (let's say upper left corner) and display all info as below.

Trade type
Entry price
Stop loss
Profit / Loss


Regarding the box, I will work on
it.


Lastly, I wanted to know how I can determine whether I'm in trade or not.
I want to achieve following...
Currently my entry is at the cross over of FastAvg & SlowAvg. However I wish to enter when price closes above SlowAvg or avg crossover whichever happens first.

However price closes above SlowAvg should check...
1. System is not in trade (if in trade than do not enter in trade)

2. Last trade must be on other side. i.e. for if my last trade is buy trade than system should look for price to close below slowAvg & vice versa.

Thank you for all your help.
The above requires higher level of
AFL Programming. I am sorry I will
not be able to do it . Later stages
when I learn some more I will
definitely work on it.

Regards
 
#32
Whenever I comment this piece of code, I get backtest result else Backtest result shows nothing. Blank and no error. I just want 2 test on Nifty making size as 50. Can anyone help ?



//Settings for Backtesting to keep lot size fixed // Need help here
SetOption("MaxOpenPositions",1);
RoundLotSize = 50;
SetOption("MinShares",RoundLotSize);
PositionSize = C*50*2;
 

myamit

Well-Known Member
#34
BuyPlus, BuyMinus, SellPlus and SellMinus
are variables defined to Plot BookProfit and SL
Lines
Can you please explain (elaborate) on following lines of code?

Code:
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

Thanks.
 

msa5678

Well-Known Member
#35
Can you please explain (elaborate) on following lines of code?

Code:
t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

Thanks.
Sorry, there is a mistake in the lines
above
It should have been
t1=Flip(Buy,Sell);
t2=Flip(Short,Cover);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

The above code is for plotting the red
dotted lines , which u see in the attachment.
These lines are nothing but offset of 20
points from the Short@ price of 5817.15

Hope the above clarifies the doubts

View attachment 16250
 
Last edited:

myamit

Well-Known Member
#39
Not working yaar. Backtest giving result but taking 50. Any other setting reqd in Backtest testing?
Could you elaborate what exactly you wish to achieve?
Code mentioned will consider 50 shares (i.e. 1 Nifty lot). If you are looking for 50 Nifty lots than use 2500 as number.
 

myamit

Well-Known Member
#40
Friends,

I need little help in coding stop loss logic. Im currently using applystop function to perform trailing stop loss. However this is giving me very little control in terms of signal. Even if stop has been applied buy/short signal is still true & hence all other conditions/visual marks are getting wrong. Any idea about either how to generate additional sell signal (when Trailing stop is hit) or otherwise how to let AmiBroker know that trade has been closed.

Thank you for all your help.
 

Similar threads