Category Other  Published on 14/09/2020

NNFX Infos on chart

Description

if you don't know anything about the NNFX way to trade, this is definitly not your download - but maybe after searching for no nonsense forex on youtube and finding his website... 

this is my first try to code something might be useful for others - an info on the chart area which calculates and displays the following: ATR in pips, which is also the take profit level (TP) for the first half of the trade - stoploss in pips (SL) - pipvalue (PV) with the tradevalue (TV) and your actual risk amount. It would be great to get constructive feedback via this platform here or ctraderNNFX (at) gmail and, maybe, form an NNFX group for cTrader somewhere. Thanks and cheers to VP and: go - GET it! 

In the moment I'm working on a NNFX MANUAL STRATEGY TESTER to help backtest the algorithm (or parts of it). So I have little to no knowledge of coding C# or any other programming language, together with the difficulties to understand the cTrader API programming interface, and to figure out BASELINE, C1, C2, EXIT and VOLUME indicators it's a bumpy road and I would be very happy to get in discussion with NNFX people on the cTrader way... 

a little teaser for my ideas on backtesting the NNFX logic with cTraders backtesting functions:

what do I have so far?

+ create buy or sell order with a mouseclick

+ splitting the order in two parts, both with SL, only one with TP

+ close an order with a mouseclick 

+ risk % adjustable between 2% and 0.25% with a click

+ orders a created automaticlly with the correct TP ans SL based on the ATR formula from VP

+ correct trading volume based on risk% and account balance

+ adjusting the SL to breakeven

+ taking care of the trailing stops based on the NNFX way of trading

+ automated slowdown of the backtesting engine when it's time to trade

...

cheers to VP from no nonsense forex 

 

 

 

 

 

 

 

 

 

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NNFXInfosonchart : Indicator
    {
        [Parameter("Risk Percentage", Group = "Risk", DefaultValue = 2, MinValue = 0.5, MaxValue = 2, Step = 0.25)]
        public double RiskPercentage { get; set; }

        public IndicatorDataSeries Result;
        private AverageTrueRange atr;

        protected override void Initialize()
        {
            atr = Indicators.AverageTrueRange(20, MovingAverageType.Exponential);
            Result = CreateDataSeries();
        }



        public override void Calculate(int index)
        {

            double RiskAmount = (Account.Balance * RiskPercentage) / 100;
            double RiskPerUnit = getATRPips() * Symbol.PipValue * 1.5;
            double RiskUnits = RiskAmount / RiskPerUnit;

            Result[index] = Symbol.NormalizeVolumeInUnits(RiskUnits, RoundingMode.Down);

            string Text = "(TP) " + Math.Round(getATRPips(), 0) + " - ";
            Text += "(SL) " + Math.Round(getATRPips() * 1.5, 0) + " - ";
            Text += "(PV) " + Math.Round(Result[index] / Symbol.LotSize * 10, 2) + "$ - ";
            Text += "(TV) " + Math.Round(Result[index] / 1000, 3) + "k$ - ";
            Text += "(R) " + Math.Round(RiskAmount, 0) + "$ - go, GET it !";


            Chart.DrawStaticText("Symbols", Text, VerticalAlignment.Top, HorizontalAlignment.Left, Color.Silver);

        }

        private double getATRPips()
        {

            return atr.Result.LastValue / Symbol.PipSize;
        }
    }
}


xabbu's avatar
xabbu

Joined on 20.07.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: NNFX Infos on chart.algo
  • Rating: 5
  • Installs: 1569
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
YE
YesOrNot2 · 4 months ago

Hi Xabbu ! 

I saw that you were developing a strategy tester for NNFX. Have you finished your project? Did you find it somewhere?