I need to improve the sample rsi cbot

Created at 15 Apr 2021
AM
Status

Open


Budget

50.00 EUR


Payment Method

Direct Payment

Job Description

I need to add this things

 

Possibility to only sell or only buy
Possibility to trade in 2 time ranges during the day
Possibility to trade some days of the week to choose ( if possible )
To be able to change the ranges of Rsi buy and sell 30/70

Comments
Log in to add a comment.
KO
kotba3ilio · 3 years ago
I will do it quickly and efficiently
95
9544315 · 3 years ago

//    IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE:                                                            //
//                                                                                                              //
//    XRP (XRP) can be sent to this wallet address                                                              //
//    rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns                                                                        //
//                                                                                                              //
//    Basic Attention Token (BAT) can be sent to this wallet address                                            //
//    0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2                                                                //
//                                                                                                              //
//    Litecoin (LTC) can be sent to this wallet address                                                         //
//    LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT                                                                        //

95
9544315 · 3 years ago

// -------------------------------------------------------------------------------------------------------------//
//                                                                                                              //
//    This cBot is intended to be used as a TEST and does not guarantee any particular outcome or               //
//    profit of any kind. Use it at your own risk.                                                              //
//                                                                                                              //
//    ALL buy and sell orders are executed at the beginning of a new bar and if the RSI conditions are met.     //
//                                                                                                              //
//    The "OBiAL_RSI_cBot" will create a buy order when:                                                        //
//    "Relative Strength Index indicator < LVDOUP" and "Relative Strength Index indicator > LVDODO" .           //
//                                                                                                              //
//    The "OBiAL_RSI_cBot" will create a Sell order when:                                                       //
//    "Relative Strength Index indicator > LVUPDO" and "Relative Strength Index indicator < LVUPUP" .           //
//                                                                                                              //
//    The SL and TP parameters are set for every order of different than zero.                                  //
//                                                                                                              //
//    The cBot can generate only one Buy or Sell order at any given time.                                       //
//    Days of week need to be selcted in order to allow specific ones                                           //
//    Hours between Hour plus and Hour minus are allowed for trading.                                           //
//                                                                                                              //
//    IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE:                                                            //
//                                                                                                              //
//    XRP (XRP) can be sent to this wallet address                                                              //
//    rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns                                                                        //
//                                                                                                              //
//    Basic Attention Token (BAT) can be sent to this wallet address                                            //
//    0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2                                                                //
//                                                                                                              //
//    Litecoin (LTC) can be sent to this wallet address                                                         //
//    LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT                                                                        //
//                                                                                                              //
// -------------------------------------------------------------------------------------------------------------//

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class OBiAL_RSI_cBot : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }
        [Parameter("RSI Periods", DefaultValue = 14)]
        public int Periods { get; set; }
        [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }
        [Parameter("Def SL", DefaultValue = 20, MinValue = 0)]
        public int DefSL { get; set; }
        [Parameter("Def TP", DefaultValue = 20, MinValue = 0)]
        public int DefTP { get; set; }
        [Parameter("LVUPUP", DefaultValue = 80, MinValue = 0)]
        public int LVUPUP { get; set; }
        [Parameter("LVUPDO", DefaultValue = 70, MinValue = 0)]
        public int LVUPDO { get; set; }
        [Parameter("LVDOUP", DefaultValue = 30, MinValue = 0)]
        public int LVDOUP { get; set; }
        [Parameter("LVDODO", DefaultValue = 20, MinValue = 0)]
        public int LVDODO { get; set; }
        [Parameter("Allow Buy", DefaultValue = true)]
        public bool LBuy { get; set; }
        [Parameter("Allow Sell", DefaultValue = true)]
        public bool LSell { get; set; }

        [Parameter("Allow Mon", DefaultValue = true)]
        public bool LMon { get; set; }
        [Parameter("Allow Tue", DefaultValue = true)]
        public bool LTue { get; set; }
        [Parameter("Allow Wed", DefaultValue = true)]
        public bool LWed { get; set; }
        [Parameter("Allow Thu", DefaultValue = true)]
        public bool LThu { get; set; }
        [Parameter("Allow Fri", DefaultValue = true)]
        public bool LFri { get; set; }

        [Parameter("Hour Plus", DefaultValue = 7, MinValue = 0, MaxValue = 23, Step = 1)]
        public int HPlus { get; set; }
        [Parameter("Hour Minus", DefaultValue = 17, MinValue = 0, Step = 1)]
        public int HMinus { get; set; }



        private RelativeStrengthIndex rsi;

        protected override void OnStart()
        {
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
        }

        protected override void OnBar()
        {

            bool CheckDay = false;
            if (Server.Time.DayOfWeek == DayOfWeek.Monday && LMon == true)
                CheckDay = true;
            if (Server.Time.DayOfWeek == DayOfWeek.Tuesday && LTue == true)
                CheckDay = true;
            if (Server.Time.DayOfWeek == DayOfWeek.Wednesday && LWed == true)
                CheckDay = true;
            if (Server.Time.DayOfWeek == DayOfWeek.Thursday && LThu == true)
                CheckDay = true;
            if (Server.Time.DayOfWeek == DayOfWeek.Friday && LFri == true)
                CheckDay = true;


            bool CheckHour = false;
            if (Server.Time.Hour > HPlus && Server.Time.Hour < HMinus)
                CheckHour = true;

            if (rsi.Result.LastValue < LVDOUP && rsi.Result.LastValue > LVDODO && LBuy && CheckDay && CheckHour)
            {
                Open(TradeType.Buy);
            }
            else if (rsi.Result.LastValue > LVUPDO && rsi.Result.LastValue < LVUPUP && LSell && CheckDay && CheckHour)
            {
                Open(TradeType.Sell);
            }
        }

        private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("TEST_RSI", SymbolName, tradeType))
                ClosePosition(position);
        }

        private void Open(TradeType tradeType)
        {
            var position = Positions.Find("TEST_RSI", SymbolName, tradeType);
            var volumeInUnits = Symbol.QuantityToVolume(Quantity);

            if (position == null)
                ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "TEST_RSI", DefSL, DefTP);
        }
    }
}

bienve.pf's avatar
bienve.pf · 3 years ago

Hi. I can do that.

Whatsapp: (+34)654 11 55 47

Telegram: @bienveP

Regards

DonaldD's avatar
DonaldD · 3 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

SA
sascha.dawe · 3 years ago

Hi,

 

I can help with your RSI bot. 

Please contact sascha.coding@gmail.com

 

Regards, 

Sascha