i decided to run the same script without it. still the best is when security set to 1 min but without the difference not so much.
it just to show the concept of the strategy that based on cross hull as buy signal
and the the take profit target. so maybe now its also repaint?:)
1. Does profit ticks and loss ticks keep changing with close price? I never used profit and loss ticks for same reason. Will try to experiment a bit.
2. With default pyramiding configuration in place, do we need multiple entry and exit lines or is it just to mark it with different label?
Thanks for the script. Few things to learn :)
I personally have never thought to use strategy.opentrades though as a mechanism for pyramiding.
I believe the profit ticks and loss ticks are reliable and don't change unless the referencing variable changes. Here's a chunk from my strategy tester:
// Take Profit Short
tpPrice_S = 0.0
tpPrice_S := if strategy.position_size < 0 and c_tpType == tp1
tpPrice_S := strategy.position_avg_price * (1 - i_pctTP)
else if strategy.position_size < 0 and c_tpType == tp2
tpPrice_S := strategy.position_avg_price - (syminfo.mintick * i_tickTP)
else if strategy.position_size < 0 and c_tpType == tp3
tpPrice_S := strategy.position_avg_price - (atr(i_atrLength) * i_atrMult)
else if strategy.position_size < 0 and c_tpType == tp4
tpPrice_S := lowerBand
else if strategy.position_size < 0 and c_tpType == tp5 and c_tpType != st7
tpPrice_S := strategy.position_avg_price - ((rrStop_S - strategy.position_avg_price) * i_rrMult)
tpPrice_S := 0
strategy.exit("Exit Short", from_entry = "Short", qty_percent = 100, limit = tpPrice_S, stop = stopPrice_S)
Some of those are dynamic and some are static. And they all fire correctly using the limit/stop arguments.
It does calculate on each bar, so if the value doesn't change the stop level doesn't change, if the value does change, however, it will change.
Calculation used in the script use close (as below):
Profit_Ticks = close * (ProfitTarget_Percent / 100) / syminfo.mintick
Close changes on every bar. Hence, calculation of ticks should change too?