# Advanced features of PT Feeder

# Trading View Alerts

# Introduction

If the technical analysis functionality of ProfitTrailer is not enough, PT Feeder can be setup to react on strategies that you have setup in Trading View (opens new window) but you will need a paid for subscription after a certain number of alerts.

PT Feeder reacts on email alerts that are sent from Trading View went conditions are met. This is because Trading View does not provide an api to listen to these alerts. This does mean there are some pros and cons of using PT Feeder for trading view alerts versus something like AutoView (opens new window)

# PT Feeder Pros

  • Use Profit Trailer trailing to buy
  • Runs in the background without needing any Chrome window open
  • Re-confirm buy using ProfitTrailer indicators
  • Ability to change every ProfitTrailer property based on the alert
  • Combine a ProfitTrailer strategy with alerts in one bot (e.g scalp with TradingView and swing trade with ProfitTrailer)

# PT Feeder Cons

  • Delay. As PT Feeder uses email, there will be a bigger delay in reacting to the alerts (see below)
  • Dependent on the latency of your email provider as a middleman.
  • Intentional frequency of writing ProfitTrailer config files every 10 seconds as not to overload ProfitTrailer detecting config changes.

# AutoView Pros

  • Direct connection to the exchange so quicker reaction
  • No other middle man like your email provider as a point of failure

# AutoView Cons

  • Need to keep Chrome open
  • Cannot validate buy. Buy happens when the alert is triggered.

A couple of notes on the above.

Intentionally, there is nothing on the sell strategy in these pros and cons. PT Feeder will revert back to your normal sell strategies after the period set in 'SignalLength' in your hostsettings, and this is minutes. This is because if you are using trading view to also alert your sell, then there is no need to use ProfitTrailer. You can fully use AutoView as ProfitTrailer is redunant in this scenario.

Second comment is on delay. From speaking to people who use AutoView, the delay in a buy seems to be about 10 seconds. From testing PT Feeder and using Gmail as a email provider, the alert comes into Profit Trailer within 20 seconds. This is however dependent on the delay of you mail provider.

An example is outlined here

Due to this, my personal recommendation is that if you use 1 min candles on trading view, then PT Feeder is not the best tool for you. For anything above, I feel the fact that you get trailing buys, outweighs any latency that you may encounter.

# Setup

  1. Setup a new Gmail account here (opens new window)

Note that PT Feeder searches for unread mail as a new alert so a new email which isn't being checked is required.

  1. Enable IMAP access on your email account like below:

Imap enable

  1. Setup PT Feeder hostsettings to access email like below as an example:
  "Email": {
    "ImapServer": "imap.gmail.com",
    "ImapPort": 993,
    "ImapUsername": "EMAIL ADDRESS",
    "ImapPassword": "PASSWORD",
    "FromAddress": "noreply@tradingview.com",
    "Subject": "TradingView Alert" 
  },
  1. Setup your appsettings to change settings based on a signal. Below is an example.
  "TradingViewSignalsGrouping": {
    "Condition": "[pair.SignalDetected] == true",
    "Configs": [
      {
        "MinBuyVolumeOffset": "-75",
        "TrailingProfitOffset": "100",
        "InitialCostPercentageOffset": "100",
        "Override": {
          "DcaRebuyTimeout": "30",
          "RebuyTimeout": "120",
          "ABuyStrategy": "RSI",
          "ABuyValue": "45",
          "BBuyStrategy": "DISABLED",
          "CBuyStrategy": "DISABLED",
          "Weight": "100"
        }
      }
    ]
  },
  1. Setup your alerts on Trading View. The alert message can be just the name of the pair in the format, EXCHANGE:QUOTEBASE, for example BINANCE:QTUMBTC and you can add the word SET and specify alert specific PT properties.

An example of an alert message

BINANCE:QTUMBTC
SET
ABuyStrategy=RSI
ABuyValue=55
BBuyStrategy=DISABLED
Weight=150

OR

BINANCE:QTUMBTC

alerts

The alerts are valid for how long you set SignalLength in your hostsettings.json (default is 15 mins) After this time, the setting for that coin will revert back to the DEFAULT settings or any other pair overrides you have.

# Alert strategies

We have tested Trading View alerts with the following paid for strategies. Please let us know if you find any other good ones and we can add them to this list

Gnome Alerts Pro (opens new window)

Bitcoin Ninja's (opens new window) (mention that you want to use with PT Feeder)

# QuickAlerts

A chrome plugin is available which is highly reccomended. It manages your alerts via CSV file so you upload mutiple alerts in one go and and edit them via Excel or another spreadsheet programme. It works with both the signal scripts below. It can be found here (opens new window)

# Create your own groupings

# Introduction

When using pair specific groupings like PriceTrendChangeGrouping, there is a condition behind the scenes that needs to be true for overrides and offsets to be applied. In this case, the price change over the 1st item in your MeasureTimes has to be lower than the trigger, MaxPriceTrendPercentageChange, for the condition to be true.

But you can create your own custom conditions based on the properties the are available to you.

The properties available on the market, position and pair will be updated on this (opens new window) page.

For each of these indicators, the following indicator properties need to be set in the PtFeeder section of your appsettings (with examples)


    "EmaShortCandleSize": "5m", 
    "EmaLongCandleSize": "5m", 
    "EmaShortPeriod": "13", 
    "EmaLongPeriod": "63",
    
    "SmaShortCandleSize": "5m", 
    "SmaLongCandleSize": "5m",   
    "SmaShortPeriod": "13", 
    "SmaLongPeriod": "63", 
    
    "RsiLongPeriod": "40",
    "RsiShortPeriod": "20",
    "RsiShortCandleSize": "5m",
    "RsiLongCandleSize": "5m",

    "BaseHighLowPriceChangeCandleSize": "5m",
    "HighestCandlesSize": "5m",
    "LowestCandlesSize": "5m",

Possible candle sizes are 1m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1mon. The supported values depends if your exchange supports those candle periods. If you use a period not supported by your exchange, you will get an error. The more different candle sizes you use, the slower PT Feeder will be in starting up and will consume more memory.

To use different time trends with the any of the above market or pair properties, you use the number of the time window you would like from the MeasureTimes property. For example, if this property is: "MeasureTimes": [ 120, 360, 720, 1000 ], and you would like to use the 1000, your custom condition could look like this:

"Condition": "[market.BaseCoinPriceChange(4)] - [pair.PercentageChange(4)] <= [config.TriggerName] ",

As an example of how this could be used, the below looks at difference between the short SMA and the long SMA of your base coin, BTC for example. If the short is less than the long, then we consider it a bear market.

"MarketConditionsGrouping": {
    "Condition": "[market.BaseCoinShortSma] - [market.BaseCoinLongSma] < [config.SmaDifference]",
    "Configs": [
      {
        "Name": "Bear",
        "SmaDifference": "0"

      },
      {
        "Name": "Bull",
        "SmaDifference": "100000"
      }
    ]
  },

# Previous values

You can also access the previous values for use in custom conditions to measure change. They are nested up to the 4 previous values. This can be used if you want to calculate any rate of change calculations.

The below gets the values each indicator was the last time Feeder calculated. This is set in MarketConditionCheckInMinutes in your hostsettings.

[pair.PercentageChange] - [pair.Previous.PercentageChange] > [config.ChangeInPricePercentage]

The below gets the value that indicator last was, irresepective on when it was last calculated.

[pair.PercentageChange] - [pair.PercentageChange.Previous] > [config.ChangeInPricePercentage]

# Position management

  • Create custom conditions based on ProfitTrailer positions. ProfitTrailerServerApiToken1 needs to be added to hostsettings. See ProfitTrailer wiki on how to set this here (opens new window). The object positions is available and it has the following properties:

Within custom groupings, you can also change your settings based on the positions and exposure you have within ProfitTrailer.

positions.TotalPairsCurrentValue
positions.TotalDcaCurrentValue
positions.TotalPairsBoughtCost
positions.TotalDcaBoughtCost
positions.PairsBalance
positions.DcaBalance
positions.RealBalance
positions.DcaCoinCount
positions.PairsCoinCount

positions.TotalPendingCurrentValue
positions.TotalPendingBoughtCost
  • Pair properties also available
pair.DcaCount 
pair.Profit
pair.TotalCost 
pair.FirstBoughtInMinutes

pair.PendingBoughtCost 
pair.PendingValue 
pair.PendingCount 

# Worked Example

Lets say we wanted to create a grouping that reacted on the relative percentage change of a coin compared to its base coin.

  1. Firstly we create the grouping. It can be called anything as long as it ends with Grouping.
"WikiExampleGrouping": {
    "Configs": [
      {
        
      },
    ]
  },
  1. We then need to add the condition element.

 







"WikiExampleGrouping": {
    "Condition": "",
    "Configs": [
      {
        
      },
    ]
  },
  1. The properties available need to be in square brackets and any operators need to be standard C# operators. A simple list can be found here (opens new window) under Arithmetic, Relational and Logical. We want to take the base coin change and subtract the price change of coin. If this value is less than the trigger, then we want to act.

The trigger is created using [config.TriggerName].


 







"WikiExampleGrouping": {
    "Condition": "[market.BaseCoinPriceChange(1)] - [pair.PercentageChange(1)] <= [config.TriggerName] ",
    "Configs": [
      {
        "TriggerName": "-1",
      },
    ]
  },
  1. Then we can apply offsets and overrides as we normally do
"WikiExampleGrouping": {
    "Condition": "[market.BaseCoinPriceChange(1)] - [pair.PercentageChange(1)] <= [config.TriggerName] ",
    "Configs": [
      {
        "TriggerName": "-1",
        "TrailingProfitOffset": "100",
        "InitialCostPercentageOffset": "100",
        "Override": {
          "DcaRebuyTimeout": "30",
          "DcaBuyTrigger": "-5",
          "RebuyTimeout": "120",
          "TrailingBuy": "0",
          "ABuyStrategy": "RSI",
          "ABuyValue": "45",
          "BBuyStrategy": "DISABLED",
          "CBuyStrategy": "DISABLED",
          "Weight": "100"
        }
      },
    ]
  },

# Thoughts on how this can be used

The possiblities are endless. Send me a direct message on how you have used this and I will add in here including examples.

  • Look at the difference between different time trends.
  • Look at the difference between different volume trends.
  • Action if the coin is a paticular coin name
  • Only action if the market is going down and the coin is going down
  • Only action if the coin is going up but the market is going down
  • Compare different volatility calculations

# Snippets

For common groups of config that are used in PT Feeder, a snippet can be created. This allows you not to repeat similar sections in your appsettings files, over and over again.

"Snippets": [
    {
        "SnippetName": "SellDefault",
        "ASellStrategy": "GAIN",
        "ASellValue": "0.25",
        "BSellStrategy": "STOCHRSICROSS",
        "BSellValue": "-0.01",
        "CSellStrategy": "RSI",
        "CSellValue": "50",
        "Weight": "120"
    },
    {
        "SnippetName": "SellQuick",
        "ASellStrategy": "GAIN",
        "ASellValue": "0.01",
        "BSellStrategy": "DISABLED",
        "CSellStrategy": "DISABLED",
        "Weight": "99"
    },
]

To use the snippets, you can do something like:

"TestingSnippetGrouping": {
    "Condition": "[pair.DcaCount] >= [config.DcaCount]",
    "Configs": [
        {
            "DcaCount": "2",
            "Override": {
              "InsertSnippets": "SellQuick,SellSlow",
              "Weight": "98"
            }
        }
    ]
}