RafaelZioni

Pyramiding BTC 5 min no security

2084 views
252
Since some say that the script with the security is repaint and the results too preety
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 linear regression cross hull as buy signal
and the the take profit target. so maybe now its also repaint?:)

based
Remove from Favorite Scripts Add to Favorite Scripts

Comments

diffrent settup for 5 min, put 500 on fast ,250 on slow filter exit at 20% take profit (it look nicer:)
+5 Reply
thank you Rafael.. This is only long , also Have for short
+4 Reply
Few interesting things in the script.

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 :)
+2 Reply
kurtsmock HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, Great questions =) I was thinking the same thing about the default pyramiding vs the way Rafael has it written.
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)
else
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.
+1 Reply
@kurtsmock, Thanks for the response.

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?
Reply
kurtsmock HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, From what I can tell yes, it does change the calculation since the close price is used. But, since its based on the entry price, it can wobble around, but can't run away. I just did a quick and dirty plot of the TP lines. Its not accurate because I don't have exact entries calculated, I just used strategy.position_avg_price But its close enough to show us what's going on there. We would need to do some more work to actually capture the exact entry price of each position and calculate each individual positions stop, because they are not all equal, then it would line up dead on. Using average price is insufficient because its collating the prices of the entries together and the strat is taking them individually.
+1 Reply
@kurtsmock, Thanks very much. I probably stick to setting stop - which seems much safer and cleaner :)
+1 Reply
kurtsmock HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, Yea all good. There are other ways of doing it for sure that give you a consistent, precise stop.
Reply
PaulE1111 kurtsmock
@kurtsmock, do you mind send me this code, How to do the TP line like this. Thank you very much, I really appreciate
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out