[Back Friday] Free MA Cross 9$ Others free

by nghiand.amz in category Trend at 17/11/2022
Description

I promote all my bots in November to 9$

You can check at

Demo Free: https://nghia312.gumroad.com/?max_price=8

BlackFriday: https://nghia312.gumroad.com/?min_price=9

 

 

Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MACrossSample : Robot
    {
        [Parameter("Source")]
        public DataSeries SourceSeries { get; set; }
        [Parameter("Label", DefaultValue = "EMA")]
        public string label { get; set; }

        [Parameter("Slow Periods", DefaultValue = 20)]
        public int SlowPeriods { get; set; }
        [Parameter("Fast Periods", DefaultValue = 10)]
        public int FastPeriods { get; set; }

        [Parameter("By Percent", DefaultValue = false)]
        public bool IsTradeByPercent { get; set; }

        [Parameter("Quantity (Lots)", DefaultValue = 0, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Quantity (Percent)", DefaultValue = 1, MinValue = 0.01, Step = 1)]
        public double QuantityByPercent { get; set; }

        [Parameter("SL", DefaultValue = 0)]
        public double Stoploss { get; set; }

        [Parameter("TP", DefaultValue = 0)]
        public double TakeProfit { get; set; }

        [Parameter("Type Moving", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType Type { get; set; }

        private MovingAverage slowMa;
        private MovingAverage fastMa;


        protected override void OnStart()
        {

            fastMa = Indicators.MovingAverage(SourceSeries, FastPeriods, Type);
            slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, Type);

        }

        protected override void OnTick()
        {
            //Nếu có lợi nhuận dương mà về 0 thì tự cắt luôn cho mát

         
        }

        protected override void OnBar()
        {
            // Nếu mà giá chạy xa quá thì không vào lệnh nữa
            if (fastMa.Result.Last(2) < slowMa.Result.Last(2) && fastMa.Result.Last(1) > slowMa.Result.Last(1))
            {
                CloseAll();
                ExecuteMarketOrder(TradeType.Buy, SymbolName, VolumeInUnits, label,Stoploss,TakeProfit);
            }

            if (fastMa.Result.Last(2) > slowMa.Result.Last(2) && fastMa.Result.Last(1) < slowMa.Result.Last(1))
            {
                CloseAll();
                ExecuteMarketOrder(TradeType.Sell, SymbolName, VolumeInUnits, label, Stoploss, TakeProfit);
            }
        }
        private double VolumeInUnits
        {

            get { 
                if(IsTradeByPercent)
                {
                    return Math.Floor(Account.Balance * 10 * QuantityByPercent / 1000) * 1000;
                }

                return Symbol.QuantityToVolumeInUnits(Quantity); 
            }
        }

        private void CloseAll()
        {
            var positions = Positions.FindAll(label);

            foreach (var item in positions)
            {
                item.Close();
            }

        }
    }
}
Comments

asshancuc - November 19, 2022 @ 04:40

As I am looking at your writing, majorsite I regret being unable to do outdoor activities due to Corona 19, and I miss my old daily life.   If you also miss the daily life of those days, would you please visit my site once? My site is a site where I post about photos and daily life when I was free. 

birolbahadirs - November 21, 2022 @ 13:54

Racism against Muslims isn't news for most people. In the last hundred years, Muslims have been abused mentally and physically due to their religion. And they continue to face the same hostility all around the globe. Birol Bihadar's book, Between Two Worlds, talks about the problems that immigrants face. As a victim himself, he wants to share with the world what he had to endure in his life.

nolancharles803 - November 23, 2022 @ 07:47

Global e-commerce based buying and selling market. Our Gluons.shop Technology company started the journey in 2015 with all kind of automation products.

0