Edit Your Comment
I need help solving this programming Riddle (RSI).
Sep 25, 2019 부터 멤버
게시물1
Sep 25, 2019 at 02:46
(편집됨 Sep 25, 2019 at 02:49)
Sep 25, 2019 부터 멤버
게시물1
Hello there my name is Agustin,
I'm stuck programming my tradingview strategy, which involves the Relative Strength Index or by its acronym RSI. The point is that RSI can help traders to identify when an asset is oversold or overbought. An RSI of 30 or below indicates that the asset could be oversold. At the moment, my strategy works well buying when the RSI is at 30.
The problem is when the RSI graph is between 30 and 70 and goes down through 30 (giving a buy) until reaching 26 or any other number below 30. This causes a buy order to be in negatives for a moment. This executed by the instruction: buycondition= rsi==30. See RSI_AAASTRATEGY.jpg to better understand what was previously reported.
What I am looking for is to be able to place a purchase order when the rsi goes up through 30 to channel 30 to 70 after having already gone through 30 when it came down to negatives. Not when it goes through 30 into negatives.
If you can help me raise the instructions for this process, I would appreciate it and give more details about my strategy to the person who solves it.
I'm stuck programming my tradingview strategy, which involves the Relative Strength Index or by its acronym RSI. The point is that RSI can help traders to identify when an asset is oversold or overbought. An RSI of 30 or below indicates that the asset could be oversold. At the moment, my strategy works well buying when the RSI is at 30.
The problem is when the RSI graph is between 30 and 70 and goes down through 30 (giving a buy) until reaching 26 or any other number below 30. This causes a buy order to be in negatives for a moment. This executed by the instruction: buycondition= rsi==30. See RSI_AAASTRATEGY.jpg to better understand what was previously reported.
What I am looking for is to be able to place a purchase order when the rsi goes up through 30 to channel 30 to 70 after having already gone through 30 when it came down to negatives. Not when it goes through 30 into negatives.
If you can help me raise the instructions for this process, I would appreciate it and give more details about my strategy to the person who solves it.
Jan 05, 2016 부터 멤버
게시물1097
Oct 06, 2019 at 02:29
Oct 03, 2019 부터 멤버
게시물1
@agaguilara, this is what you want
_rsi = rsi(close, 14)
enter_long = crossover(_rsi, 30)
exit_long = crossover(_rsi, 70)
enter_short = crossunder(_rsi, 70)
exit_short = crossunder(_rsi, 30)
strategy.entry(id="Buy it", long=true, qty=1.0, when=enter_long)
strategy.exit(id="Sell it", from_entry="Buy it", qty=1.0, when=exit_long)
strategy.entry(id="Short sell it", long=false, qty=1.0, when=enter_short)
strategy.exit(id="Cover it", from_entry="Short sell it", qty=1.0, when=exit_short)
_rsi = rsi(close, 14)
enter_long = crossover(_rsi, 30)
exit_long = crossover(_rsi, 70)
enter_short = crossunder(_rsi, 70)
exit_short = crossunder(_rsi, 30)
strategy.entry(id="Buy it", long=true, qty=1.0, when=enter_long)
strategy.exit(id="Sell it", from_entry="Buy it", qty=1.0, when=exit_long)
strategy.entry(id="Short sell it", long=false, qty=1.0, when=enter_short)
strategy.exit(id="Cover it", from_entry="Short sell it", qty=1.0, when=exit_short)
Nov 21, 2011 부터 멤버
게시물1601
Oct 11, 2019 at 14:52
Nov 21, 2011 부터 멤버
게시물1601
Hello,
Obviously it not a code issue... it is a about conception.
That would be a better way to trade with RSI on the way you define.
Solution is quite simple:
Let's say every hour (once per hour), you stock into variables the value of RSI.
So now you have previous RSI.
Now you can also stock the minimun value of RSI based on this previous RSI.
Exemple:
If previous RSI < Miminum RSI then Mimimun RSI = Previous RSI.
Now you can get your entry:
If RSI > Previous RSI and RSI > 30 and Miminum RSI < 28 (for exemple) THEN trigger BUY.
This way you have designed your picture.
Once you triger Long, you reset to zero both variables for RSI (Privious and Minimun).
So to make sur you triger trades properly, you specify both variables different to 0:
If RSI > Previous RSI and RSI > 30 and Miminum RSI < 28 (for exemple) and (Previous RSI <>0 and Mimimun RSI <>0) THEN trigger BUY.
You do the same logic for Short strategy.
Good luck.
Crazytrader
Obviously it not a code issue... it is a about conception.
That would be a better way to trade with RSI on the way you define.
Solution is quite simple:
Let's say every hour (once per hour), you stock into variables the value of RSI.
So now you have previous RSI.
Now you can also stock the minimun value of RSI based on this previous RSI.
Exemple:
If previous RSI < Miminum RSI then Mimimun RSI = Previous RSI.
Now you can get your entry:
If RSI > Previous RSI and RSI > 30 and Miminum RSI < 28 (for exemple) THEN trigger BUY.
This way you have designed your picture.
Once you triger Long, you reset to zero both variables for RSI (Privious and Minimun).
So to make sur you triger trades properly, you specify both variables different to 0:
If RSI > Previous RSI and RSI > 30 and Miminum RSI < 28 (for exemple) and (Previous RSI <>0 and Mimimun RSI <>0) THEN trigger BUY.
You do the same logic for Short strategy.
Good luck.
Crazytrader

*상업적 사용 및 스팸은 허용되지 않으며 계정이 해지될 수 있습니다.
팁: 이미지/유튜브 URL을 게시하면 게시물에 자동으로 삽입됩니다!
팁: @기호를 입력하여 이 토론에 참여하는 사용자 이름을 자동으로 완성합니다.