Je_Buurman

How to create a Strategy and make it profitable

Education
Je_Buurman Updated   
BYBIT:BTCUSD   None
A little tutorial

based on the (my) notion of:

"Do your own research"
"Don't listen to others (too much)"
"Do it yourself, you can't rely on others" aka "If you want something done right, do it yourself"


So there is a tremendous amount of information out there, plenty of strategies one can use, but what works and what not?
How to be sure?
Don't just assume or take some social media guys word for it.
TEST THEM!
It's NOT the TOOLS, it's HOW you use them.

There are several ways of and reasons for programming successful entries, exits, money management, risk management. Try them out, see what works for YOU and then work on that.

This is only a quick example of working on a script, refining a strategy.

//////////// This is not a Pine Tutorial, I'm not going to explain every detail, ample documentation on that out there ////////////

Maybe you've heard people say certain markets are closed during weekend, so you only want to buy on Monday and sell before the weekend.
Even something as simple as that can be a strategy, let's see if that can be useful.

get the Script from here:


Phase I
make the basic entry conditions:

longCondition = dayofweek==dayofweek.monday and (time > timestamp(Year, Month, 01, 00, 00, 00))
shortCondition = dayofweek==dayofweek.friday and (time > timestamp(Year, Month, 01, 23, 59, 59))
what day of the week is it and is it after a certain time/date (this is only here in case we get too many trades; > 3000)

Let's see if that buys us that Lambo
(set Long-Only and Stoploss in the menu to off first, we haven't "written" them yet)


Phase II
get some stoploss in place

The menu inputs:
Use_stoploss=input(false, title="Use stoploss ?")
stoploss_input=input(150, title="Stoploss in $")

The next one looks like a doozy but it's actually not that difficult.

Stoploss = Use_stoploss ? strategy.position_size>0 ? iff(strategy.position_size>0,strategy.position_avg_price - stoploss_input, na) : strategy.position_size<0 ? iff(strategy.position_size<0,strategy.position_avg_price + stoploss_input, na) : na : na

it means:
stoploss = {do we use Stoploss from the menu} ? if yes then {is our position Long (> 0), then take the average position size and subtract the amount from the menu} otherwise, {is our position Short ? then add the menu amount to the position size} if neither were true ..we have no position and don't need a stoploss.

plot(Use_stoploss and strategy.position_size!=0 ? Stoploss : na, color=iff(Stoploss!=na,color.silver, color.red),style=plot.style_linebr)
Are we using Stoploss and are we in an actual position ? then it draws the line it gets from the previous calculation

(now turn on stoploss in the menu while looking at the results..better? Lambo time?)

Phase III

Is this somehow profitable now .. how can we make it (more) profitable.
Maybe only go Long, add some other variables..
Don't just throw out the whole idea immediately - don't give up so quickly - you made it this far, why quit now? Maybe it doesn't work all that great on this or that Crypto, maybe it DOES on some commodities, stocks, other asset-classes or under different conditions?
Don't be lazy, if you want to make money, you WILL have to do it YOURSELF, nobody is going to do it for you. If someone CLAIMS they want to sell you a working system .. why, apparently, aren't they using it themselves but ask for money from YOU ?

Feel free to take a look at the Related idea's linked below...they are related.
Comment:
example of how the 'same' strategy works on UKOIL


Script gets a little update ..
Comment:
As you can see with BTC and UKOIL, different 'assets' can behave differently on the same strategy (some might even be right out disastrous compared to others).

Small addendum to Phase III
How could we make it even more profitable ????
Anal-yze the results, look at the trades taken on the chart and identify the sub-par trades.


The orange ones could have been even more profitable if held longer
and the yellow one was in profit but profit has not been taken in time.
... if only we could come up with a way to adjust the (atm static) stoploss above entry (aka break-even) or even higher depending on price action. ;)
The orange trade would have benefited from this too if 'Friday sell' is interdepended on Day AND stoplevel.
Comment:
the script has been updated ..

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.