Strategy building with multiple paths and blocks can become very complicated as users tend to use some conditions in repetition. Users also need the ability to exit a trade based on 'which path' caused the trade entry
The REF block helps solve the above problems by letting a user 'refer' to the value of a particular path either at the current candle or when the last trade happened.
How to use the 'REF' block?
1. Using the 'At last trade condition'
Let's say you have a strategy that has 2 BUY conditions
- Buy when RSI <30
- Buy when Diff in MACD crosses up 0
For SELL, you want to exit when
- RSI >70 if the entry was because of RSI
- Diff MACD crosses down 0 if the entry was because of MACD
Here is how you would make it
1. Connect 2 indicator blocks, one for RSI and other of MACD, with the buy block
2. You would now set up 2 exit condition using 6 blocks 3 for the RSI exit, 3 for the MACD exit
The ref block for the RSI exit would look like this:
You would then connect the REF block to an AND block and then link it to another indicator block like this
You would similarly setup the exit for the MACD and then connect both to the sell block to make your strategy.
NOTE: In the case of 'Value' at last candle, the REF block is 'TRUE' if the path it refers to was 'TRUE' when the last trade happened. This does not imply that the path that it refers to 'caused' the trade. The trade could have been caused irrespective of what the path value was based on how the path is used in conjunction with other conditions. This block will just replicate the 'truth value' of the path and nothing else.
2. Using the 'At current candle' option
This option is useful when you just want to reuse a certain set of conditions. Instead of making te blocks again, you can just use the ref block and refer to the valve of that path.