Dear friends,
I am new to AFL and developing a trading system/strategy using MACD and RSI. It generates signals and they are plotted in the chart too. For formula, refere one of my thread question in this board itself.
I want to implement a Stoploss and Profit target (if possible) for the buy and sell signals. I read the AFL help, but still couldnt understand the correct usage.
I tried the following code:
ApplyStop(0,2,15,2);
//param1 = 0 = type, MaximumStoploss
//param2 = 2 = mode, amount in points
//param3 = 15 = amount, in this case 15 pts
//param4 = 1 = exitatstop, exit at next bar
Plot(ShapeStar * Applystop(0,2,152) , ColorYellow);
I assumed this would show 1 stoploss signal after a buy/sell arrow. But for each bar in the price chart, the yellow stars show. Can anyone suggest me how to code this scenerio:
1. After a buy, the maximum SL is 15 pts and the Profit target is 20 pts
2. After a sell, the maximum SL is 15 pts and the profit target is 20 pts.
The SL signal and the profit signal should appear in the chart and should stay there. Not to be a trailing stop.
Thanks for any reply and help.
kesk
I am new to AFL and developing a trading system/strategy using MACD and RSI. It generates signals and they are plotted in the chart too. For formula, refere one of my thread question in this board itself.
I want to implement a Stoploss and Profit target (if possible) for the buy and sell signals. I read the AFL help, but still couldnt understand the correct usage.
I tried the following code:
ApplyStop(0,2,15,2);
//param1 = 0 = type, MaximumStoploss
//param2 = 2 = mode, amount in points
//param3 = 15 = amount, in this case 15 pts
//param4 = 1 = exitatstop, exit at next bar
Plot(ShapeStar * Applystop(0,2,152) , ColorYellow);
I assumed this would show 1 stoploss signal after a buy/sell arrow. But for each bar in the price chart, the yellow stars show. Can anyone suggest me how to code this scenerio:
1. After a buy, the maximum SL is 15 pts and the Profit target is 20 pts
2. After a sell, the maximum SL is 15 pts and the profit target is 20 pts.
The SL signal and the profit signal should appear in the chart and should stay there. Not to be a trailing stop.
Thanks for any reply and help.
kesk