Virtual Exchange Broker DSR - rapmd73/JackrabbitRelay GitHub Wiki
DSR (Duplicate Signal Remover)
If you've spent any amount of time using TradingView on lower timeframes, you have become painfully aware of the propensity of duplicated or cached (common called misfired) signals. This is a serious issue that can and has cost many people significant money.
The DSR works to help solve that issue. While no system is 100% full proof, the DSR has had a year of testing and operational fortitude to prove it goes a long way of protect your investments from misfires.
The DSR was specifically built for Jackrabbit TV DCA and Analyzer modules.
Below is an example of the TradingView alert message. The Comment
elements are strictly for you and ignored by the DSR.
{
"Comment1":"Relay required elements",
"Time":"{{time}}",
"Recipe":"#ATR #RSI #DCA",
"Action":"Buy",
"Exchange":"dsr,kucoin",
"Account":"Sandbox,MAIN",
"Market":"Spot",
"USD":"1%",
"Asset":"{{ticker}}",
"Comment4":"Price used in limit orders as well as DSR",
"Price":"{{close}}",
"Comment2":"DSR required elements in addition to above",
"AvgProfit":"{{plot_0}}",
"LProfit":"{{plot_1}}",
"TCycles":"{{plot_2}}",
"CBuys":"{{plot_3}}",
"MBCycle":"{{plot_4}}",
"TBuys":"{{plot_5}}",
"PSize":"1%",
"Link":"https://www.tradingview.com/chart/lMQAJ6YU",
"Identity":"YourIdentity"
}
Important: the exchange AND the account items must corespond with each other,
{
"Exchange":"dsr,kucoin",
"Account":"Sandbox,MAIN",
}
In the above example, dsr
uses account Sandbox
while kucoin
uses account MAIN
. The order and count are exact between Exchange
and Account
. ALL security layers are enforced at all times, even with virtual exchanges.
IMPORTANT: When you use an exchange identity, you must create an account in the dsr.cfg that matches the exchange identity. As an example, if your exchange identity is AlphaBravoTango, then you must define an account entry that MATCHES exactly as AlphaBravoTango. If the idewntities don't match, the order will NOT be processed. This does NOT apply when everything uses the global identity, even though it must be present in the order payload.
Here is a breakdown of the above payload. All elements are required.
Property Name | Description |
---|---|
Time |
The date/time of this trade. Should be {{time}} |
Recipe |
This can be anything, buy should accurately represent the recipe you are using. It will be a key reference point for watching for duplicates |
Action |
Should be buy , sell , close , or {{strategy.order.acrion}} |
Exchange |
This is the exchange/broker list. You must have the exchange/broker to deliver the signals to AFTER the DSR |
Account |
The account to use from the exchange configuration file |
Market |
Spot or Future |
Asset |
{{ticker}} as TradingView will fill it in |
Price |
{{close}} , the current closing price at the time of the alert |
AvgProfit |
{{plot_0}} , Average Profits. These MUST be the exact TV macro used here. They will be filled in at the time of the alert |
LProfit |
{{plot_1}} , Last Profit |
TCycles |
{{plot_2}} , Completed trade cycles or sells |
CBuys |
{{plot_3}} , Current number of buys for this trade cycle |
MBCycle |
{{plot_4}} |
TBuys |
{{plot_5}} , Total buys |
Link |
The TradingView link to the chart |
Identity |
You identity for Relay. Required for version 2. |
Regular Order message | All of the regular elements to complete a standard order |
DSR Logs
Here is an example of the DSR logging system. Remember, the few seconds it takes to check your orders from TradingView could be a savings or the difference between a profit or a loss.
2022-12-01 13:35:04.485677 171983 PlaceOrder DSR 0.0.0.1.2
2022-12-01 13:35:04.485900 171983 Order parsed
2022-12-01 13:35:04.485986 171983 |- Time: 2022-12-01T13:35:00Z
2022-12-01 13:35:04.486047 171983 |- Recipe: #Momentum#MACD#BBands#DCA
2022-12-01 13:35:04.486095 171983 |- Action: close
2022-12-01 13:35:04.486142 171983 |- Exchange: dsr
2022-12-01 13:35:04.486186 171983 |- Account: OANDA
2022-12-01 13:35:04.486230 171983 |- Asset: EURUSD
2022-12-01 13:35:04.486273 171983 |- Units: 1
2022-12-01 13:35:04.486317 171983 |- Price: 1.04944
2022-12-01 13:35:04.486361 171983 |- AvgProfit: 0.3254696004791101
2022-12-01 13:35:04.486405 171983 |- LProfit: 0.3740089952736669
2022-12-01 13:35:04.486450 171983 |- TCycles: 9
2022-12-01 13:35:04.486494 171983 |- CBuys: 0
2022-12-01 13:35:04.486538 171983 |- MBCycle: 7
2022-12-01 13:35:04.486581 171983 |- TBuys: 16
2022-12-01 13:35:04.486624 171983 |- RemapSymbol: Yes
2022-12-01 13:35:04.486668 171983 |- Link: https://www.tradingview.com/chart/naYu8oKU/
2022-12-01 13:35:04.486711 171983 |- OrderType: market
2022-12-01 13:35:04.591389 171983 Dispatching to oanda/MAIN
2022-12-01 13:35:05.348388 171983 Processing Completed: 0:00:00.863039 seconds
2022-12-01 20:56:31.886044 191604 PlaceOrder DSR 0.0.0.1.2
2022-12-01 20:56:31.887778 191604 Order parsed
2022-12-01 20:56:31.887969 191604 |- Time: 2022-12-01T20:56:30Z
2022-12-01 20:56:31.888052 191604 |- Recipe: #Momentum#MACD#BBands#DCA
2022-12-01 20:56:31.888124 191604 |- Action: buy
2022-12-01 20:56:31.888192 191604 |- Exchange: dsr
2022-12-01 20:56:31.888258 191604 |- Account: OANDA
2022-12-01 20:56:31.888370 191604 |- Asset: EURUSD
2022-12-01 20:56:31.888474 191604 |- Units: 1
2022-12-01 20:56:31.888557 191604 |- Price: 1.052695
2022-12-01 20:56:31.888637 191604 |- AvgProfit: 0.3254696004791101
2022-12-01 20:56:31.888705 191604 |- LProfit: 0.3740089952736669
2022-12-01 20:56:31.888773 191604 |- TCycles: 9
2022-12-01 20:56:31.888843 191604 |- CBuys: 1
2022-12-01 20:56:31.888907 191604 |- MBCycle: 7
2022-12-01 20:56:31.888971 191604 |- TBuys: 17
2022-12-01 20:56:31.889034 191604 |- RemapSymbol: Yes
2022-12-01 20:56:31.889097 191604 |- Link: https://www.tradingview.com/chart/naYu8oKU/
2022-12-01 20:56:31.889160 191604 |- OrderType: market
2022-12-01 20:56:31.997070 191604 Dispatching to oanda/MAIN
2022-12-01 20:56:33.085232 191604 Processing Completed: 0:00:01.200950 seconds