Convert indicator a cBot TrendMag

Created at 31 Dec 2021
simonaggioriccardo's avatar

simonaggioriccardo

Joined 29.01.2021

Status

Open


Budget

40.00 EUR


Payment Method

Direct Payment

Job Description

Convert the attached indicator into a cBot

Is it possible to add the bot function that will buy on green and sell on red?

Grazie 

TELEGRAM:     Riccardo S.     +39 328 347 0121     @simonaggioriccardo     simonaggioriccardo@gmail.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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 TrendMagicVL : Indicator
    {
        [Parameter("CCI Period", DefaultValue = 20)]
        public int cciPer { get; set; }
        [Parameter("MA Method", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MaType { get; set; }
        [Parameter("ATR Period", DefaultValue = 5)]
        public int atrPer { get; set; }
        [Parameter("ATR Factor", DefaultValue = 1, MinValue = 0.1, MaxValue = 4.0)]
        public double Factor { get; set; }
        [Parameter("ATR Multiplier", DefaultValue = 1.0)]
        public double atrMul { get; set; }
        [Output("Trend Magic", LineColor = "Yellow")]
        public IndicatorDataSeries TM { get; set; }
        [Output("Trend Magic Up", PlotType = PlotType.DiscontinuousLine, LineColor = "Lime", Thickness = 2)]
        public IndicatorDataSeries TMUp { get; set; }
        [Output("Trend Magic Down", PlotType = PlotType.DiscontinuousLine, LineColor = "Red", Thickness = 2)]
        public IndicatorDataSeries TMDown { get; set; }

        private CommodityChannelIndex cci;
        private AverageTrueRange atr;
        private IndicatorDataSeries bufferUp, bufferDown, x, swap;


        protected override void Initialize()
        {
            cci = Indicators.CommodityChannelIndex(cciPer);
            atr = Indicators.AverageTrueRange(atrPer, MaType);
            bufferDown = CreateDataSeries();
            bufferUp = CreateDataSeries();
            x = CreateDataSeries();
            swap = CreateDataSeries();
        }
        public override void Calculate(int index)
        {
            bufferDown[index] = MarketSeries.High[index] + Factor * (atrMul * (100 * atr.Result[index] / MarketSeries.Close[index]));
            bufferUp[index] = MarketSeries.Low[index] - Factor * (atrMul * (100 * atr.Result[index] / MarketSeries.Close[index]));

            if (cci.Result[index] >= 0 && cci.Result[index - 1] < 0)
            {
                bufferUp[index] = bufferDown[index - 1];
            }
            if (cci.Result[index] <= 0 && cci.Result[index - 1] > 0)
            {
                bufferDown[index] = bufferUp[index - 1];
            }
            if (cci.Result[index] >= 0 && bufferUp[index] < bufferUp[index - 1])
                bufferUp[index] = bufferUp[index - 1];
            else if (cci.Result[index] <= 0 && bufferDown[index] > bufferDown[index - 1])
                bufferDown[index] = bufferDown[index - 1];

            x[index] = cci.Result[index] >= 0 ? bufferUp[index] : cci.Result[index] < 0 ? bufferDown[index] : x[index - 1];
            swap[index] = x[index] > x[index - 1] ? 1 : x[index] < x[index - 1] ? -1 : swap[index - 1];

            TM[index] = x[index];
            if (swap[index] == 1)
            {
                TMUp[index] = x[index];
                TMDown[index] = double.NaN;
            }
            if (swap[index] == -1)
            {
                TMDown[index] = x[index];
                TMUp[index] = double.NaN;
            }
        }
    }
}

 

 

 

Comments
Log in to add a comment.
MO
mohsabry.ms · 2 years ago

HELLO

I'm Mohamed Sabry have long experience in cBots Development

I can covert this indicator to Bot

also make more than your requirements that could help you to win more such as choose the running time frame from the BOT and also the a spesific time to trade 

and much more

Looking forward to hearing from you.

4xdev.team's avatar
4xdev.team · 2 years ago

Hello!
My name is Mike from 4xdev. I am a member of the 4xdev development company, specialized in creating trading tools:
custom indicators, EAs, scripts, bots, alerts, cAlgo, cBots, etc.

We have a great experience in a сTrader platform.
Our clients are satisfied with the quality of our work and repeatedly contact us after completing an order to optimize their own cAlgos.
You can see reviews of us at forexpeacearmy.com and trustpilot.com, and our website 4xdev.com.

We can help you with your project. Please let me know if you are interested: support@4xdev.com

We offer the rate in the amount of $60 per hour, including the work of our programmers and QA-engineer.
The cost starts from $300 on average.

Looking forward to hearing from you.

DonaldD's avatar
DonaldD · 2 years ago

Hi there,

We can help you with your project. You can contact us at contact@clickalgo.com for more information.

Best Regards,

Donald