How to write my own PT Feeder strategy

If you are new to PT Feeder, it can be a bit daunting. There are lots of possiblities to configure, and idea than can be implemented but looking at the appsettings.json file, you can end up confused and have no clue where to begin. This page will go through a basic setup of a PT Feeder strategy.

Firstly, make sure you have followed the installation steps of PT Feeder, you have it up and running and connecting to the ProfitTrailer api.

Generate an appsettings.json file.

There are plenty of kind souls who freely share their settings. Some of these guys share PT Feeder settings, and others PT files. These are people like CryptoCrow, CryptoCoyn and CryptoGnome.

For this how to, I'm going to use CryptoGnomes settings as an example, but you could use your own or those that come bundled with ProfitTrailer too.

There are two ways of creating a appsettings.json file. You can do it manually as per the instructions on here, or you can use my PT2PTF tool. I am going to use the tool.

Download PT2PTF

Go to this page and download PT2PTF from the releases page.

Download some settings.

So in this example, I'm using CryptoGnomes ProfitTrailer Version 2 Settings

Extract settings

Extract the zip file contents into a new folder. There should be three files, PAIRS.properties, DCA.properties and INDICATORS.properties. Make sure the capital case of these files is the same.

Copy PT2PTF

Copy the pt2ptf.jar file into the same folder as the setting/

Open a cmd prompt, or a terminal window, or a linux prompt and navigate to this new folder you have pt2ptf.jar and the settings files in.

Run PT2PTF

Type java -jar pt2ptf.jar.

I should now have a appsettings.json file that is exactly the same as the PT settings. There is no extra PT Feeder protection in these settings, but they can be ran with PT Feeder as is, and that is the same as running those settings in ProfitTrailer directory.

The appsettings.json generated will look something like this:


{
  "PtFeeder" : {
    "BaseCurrency" : "BTC",
    "ExcludedCoins" : "BNB,TRX",
    "HiddenCoins" : "ALL",
    "MeasureTimes": [ 120, 360, 720 ],
    "TopCurrenciesToCheck" : "35"
  },
  "Common" : {
    "DcaKeepBalance" : "0",
    "DcaKeepBalancePercentage" : "0",
    "EnabledPairs" : "ALL",
    "IndicatorsBbCandlePeriod" : "300",
    "IndicatorsBbLength" : "20",
    "IndicatorsBbStd" : "2",
    "IndicatorsEmaCandlePeriod" : "300",
    "IndicatorsEmaCrossCandles" : "3",
    "IndicatorsEmaFastLength" : "3",
    "IndicatorsEmaSlowLength" : "24",
    "IndicatorsMacdCandlePeriod" : "300",
    "IndicatorsMacdFastLength" : "12",
    "IndicatorsMacdSignal" : "9",
    "IndicatorsMacdSlowLength" : "26",
    "IndicatorsRsiCandlePeriod" : "300",
    "IndicatorsRsiLength" : "14",
    "IndicatorsSmaCandlePeriod" : "300",
    "IndicatorsSmaCrossCandles" : "2",
    "IndicatorsSmaFastLength" : "12",
    "IndicatorsSmaSlowLength" : "24",
    "IndicatorsStochLength" : "14",
    "KeepBalance" : "0",
    "MaxTradingPairs" : "5",
    "PairMinListedDays" : "14",
    "PriceDropRecoverTrigger" : "0",
    "PriceDropTrigger" : "0",
    "PriceRiseTrigger" : "0",
    "PriceRiseTriggerRecover" : "0",
    "StartBalance" : "0"
  },
  "Defaults" : {
    "ABuyStrategy" : "LOWBB",
    "ABuyValue" : "5",
    "ABuyValueLimit" : "-2.5",
    "ASellStrategy" : "GAIN",
    "ASellValue" : "1",
    "BBuyStrategy" : "RSI",
    "BBuyValue" : "33",
    "BBuyValueLimit" : "0",
    "BSellStrategy" : "RSI",
    "BSellValue" : "40",
    "BuyMaxChangePercentage" : "8",
    "DcaABuyStrategy" : "LOWBB",
    "DcaABuyValue" : "5",
    "DcaABuyValueLimit" : "-2.5",
    "DcaASellStrategy" : "GAIN",
    "DcaASellValue" : "1",
    "DcaBBuyStrategy" : "RSI",
    "DcaBBuyValue" : "33",
    "DcaBBuyValueLimit" : "5",
    "DcaBSellStrategy" : "RSI",
    "DcaBSellValue" : "40",
    "DcaBuyPercentage1" : "100",
    "DcaBuyPercentage2" : "50",
    "DcaBuyPercentage3" : "50",
    "DcaBuyPercentage4" : "25",
    "DcaBuyPercentage5" : "30",
    "DcaBuyPercentage6" : "25",
    "DcaBuyPercentage7" : "20",
    "DcaBuyPercentage8" : "15.5",
    "DcaBuyPercentage9" : "12.11",
    "DcaBuyPercentage10" : "10",
    "DcaBuyPercentage11" : "8",
    "DcaBuyPercentage12" : "7",
    "DcaBuyPercentage13" : "6",
    "DcaBuyPercentage14" : "6",
    "DcaBuyPercentage15" : "5",
    "DcaBuyPercentage16" : "5",
    "DcaBuyPercentage17" : "5",
    "DcaBuyPercentage18" : "5",
    "DcaBuyPercentage19" : "5",
    "DcaBuyPercentage20" : "5",
    "DcaBuyTrigger" : "0",
    "DcaEnabled" : "true",
    "DcaIgnoreSellOnlyMode" : "false",
    "DcaMaxBuySpread" : "1.5",
    "DcaMaxBuyTimes" : "20",
    "DcaMaxCost" : "10",
    "DcaMaxProfit" : "0",
    "DcaMinOrderbookVolumePercentage" : "100",
    "DcaPendingOrderWaitTime" : "0",
    "DcaRebuyTimeout" : "10",
    "DcaStopLossTimeout" : "0",
    "DcaStopLossTrigger" : "0",
    "DcaTrailingBuy" : "0",
    "DcaTrailingProfit" : "0.147",
    "InitialCost" : "0.0015",
    "InitialCostPercentage" : "0",
    "MaxBuySpread" : "1",
    "MinBuyPrice" : "0",
    "MinBuyVolume" : "200",
    "MinOrderbookVolumePercentage" : "100",
    "PanicSellEnabled" : "false",
    "RebuyTimeout" : "2",
    "SellOnlyModeEnabled" : "false",
    "TradingEnabled" : "true",
    "TrailingBuy" : "0",
    "TrailingProfit" : "0.16"
  },
  "MarketConditionsGrouping" : {
    "Configs" : [ {
      "Name" : "Bear",
      "MaxTopCoinAverageChange" : "-2"
    }, {
      "Name" : "Boring",
      "MaxTopCoinAverageChange" : "2"
    }, {
      "Name" : "Bull",
      "MaxTopCoinAverageChange" : "10000"
    } ]
  }
}

Now for some Feederisation.

Market condition detection.

There are 3 market conditions that have been added as a starting point but with no changes.

It is at this point, you need to decide what you think is a bear, bull or boring/sideways market and what you want to do if this is the case.

PT Feeder provides you with 8 things you can check to decide: (check the wiki if there are more on here since this was written)

  • MaxTopCoinAverageChange
  • MaxTopCoinLongTermAverageChange
  • MinBaseCoinPriceChange
  • MinBaseCoinLongTermPriceChange
  • MaxBaseCoinPriceChange
  • MaxBaseCoinLongTermPriceChange
  • MaxVwapTrendChange
  • MaxTopCoinAverageChange

So say, I think a bear market is when:

  • the top coins are dropping more than 3%
  • BTC is rising more than 3% OR
  • BTC is dropping more than 2.5%.

This is going on an assumption that when BTC rises or drops then alts drop. All of these, I want to check in my short term time window which is defined in "MeasureTimes"

I would then change the market condition section to look like this:

  "MarketConditionsGrouping" : {
    "Configs" : [ {
      "Name" : "Bear",
      "MaxTopCoinAverageChange" : "-3",
      "MaxBaseCoinPriceChange" : "-3",
      "MinBaseCoinPriceChange" : "2.5",
    }, {
      "Name" : "Boring",
      "MaxTopCoinAverageChange" : "2"
    }, {
      "Name" : "Bull",
      "MaxTopCoinAverageChange" : "100000",
    } ]
  }

I may also think that a boring/sideways market is only if:

  • the top coins average percentage change is between -3 and 2

so I will leave boring as is.

Anything above a 2% change the the top alt coins, I will assume is a bull market.

Note that market conditions need to cover any scenario. This is why the bull has a MaxTopCoinAverageChange of a big number. PT Feeder checks the all conditions sequentially, so if it is not bear, or boring, it then has to be bull.

Now I need to think about what I want to do when these conditions happen.

Market condition actions

A simple thing to do it say that in a bear market, we want to reduce our number of pairs that ProfitTrailer can trade with. We can do this by using offsets. Any of the properties can be offset by adding Offset at the end of the property in PT Feeder. For example,







 










 "MarketConditionsGrouping" : {
    "Configs" : [ {
      "Name" : "Bear",
      "MaxTopCoinAverageChange" : "-3",
      "MaxBaseCoinPriceChange" : "-3",
      "MinBaseCoinPriceChange" : "2.5",
      "MaxTradingPairsOffset" : "-20",
      "",
    }, {
      "Name" : "Boring",
      "MaxTopCoinAverageChange" : "2"
    }, {
      "Name" : "Bull",
      "MaxTopCoinAverageChange" : "100000"
    } ]
  }

In the above example, I am reducing my number of trading pairs in ProfitTrailer by 20%. Another thing you might decide to do is increase your cost in a bull market. This is how you do it:







 











 "MarketConditionsGrouping" : {
    "Configs" : [ {
      "Name" : "Bear",
      "MaxTopCoinAverageChange" : "-3",
      "MaxBaseCoinPriceChange" : "-3",
      "MinBaseCoinPriceChange" : "2.5",
      "MaxTradingPairsOffset" : "-20",
      "",
    }, {
      "Name" : "Boring",
      "MaxTopCoinAverageChange" : "2"
    }, {
      "Name" : "Bull",
      "MaxTopCoinAverageChange" : "100000",
      "InitialCost" : "30"
    } ]
  }

I might also want to change my DCA trigger in a bull market so I DCA a bit slower. This might be because you think in a market that is going up, you would rather have capital available for new buys rather than having it locked up in DCA pairs that aren't doing so well at the moment. Lets do this via overrides, as changing the percentages via offsets maybe challenging.







 














 "MarketConditionsGrouping" : {
    "Configs" : [ {
      "Name" : "Bear",
      "MaxTopCoinAverageChange" : "-3",
      "MaxBaseCoinPriceChange" : "-3",
      "MinBaseCoinPriceChange" : "2.5",
      "MaxTradingPairsOffset" : "-20",
      "",
    }, {
      "Name" : "Boring",
      "MaxTopCoinAverageChange" : "2"
    }, {
      "Name" : "Bull",
      "MaxTopCoinAverageChange" : "100000",
      "InitialCost" : "30",
      "Override" : {
          "DcaBuyTrigger" : "-3",
      }
    } ]
  }

This could be a good place to leave the market conditions for now.

Lets look at coin specific grouping.

Per coin actions

The majority of changes PT Feeder allows you do is on each coin individually. This means every single coin in ProfitTrailer will have a different set of settings.

What type of things might you want to do on each coin?

All possible properties and PT feeder groupings, can be found on this page

Lets take a simple example first. High volume coins such as ETH, LTC, XRP tend to be "safer" than low volume coins, as lower volume coins are more susceptible to pumps and dump. But we still want to be involved in low volume coins, but have a lower risk in them. So lets reduce our cost for low volume coins.

To do this