Topics
24 Sep 2020, 03:44
 1043
 5
19 Aug 2020, 02:31
 827
 2
18 Aug 2020, 20:57
 802
 2
12 Aug 2020, 04:50
 1095
 2
10 Aug 2020, 22:08
 1355
 3
Replies

samuel.jus.cornelio
07 Aug 2020, 01:04 ( Updated at: 07 Aug 2020, 08:21 )

Hi guys, please. what is the correct way to place overbought and oversold parameters of the RSI? thank you for the kindness

 

 

 [Parameter("Source")]

        public DataSeries Source { get; set; }



        [Parameter("Periods", DefaultValue = 14)]
        public int Periods { get; set; }


        [Parameter("overbought", DefaultValue < 60)]
        public double overbought { get; set; }
       

        [Parameter("oversold", DefaultValue > 40)]
        public double oversold { get; set; }


@samuel.jus.cornelio

samuel.jus.cornelio
04 Aug 2020, 18:45 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi samuel.jus.cornelio,

Can you please write in English? It will be easier for us to help you. The code is a mess, did you just copy and paste stuff?

Best Regards,

Panagiotis 

Join us on Telegram

 

 


@samuel.jus.cornelio

samuel.jus.cornelio
04 Aug 2020, 17:00

RE:

PanagiotisCharalampous said:

Hi samuel.jus.cornelio,

Can you please write in English? It will be easier for us to help you. The code is a mess, did you just copy and paste stuff?

Best Regards,

Panagiotis 

Join us on Telegram

 

sorry, here is the translation of my post, thanks for your attention

 

Hello guys, I have found some problems with my code and I can't find an answer to solve the problem.

I am receiving an error warning regarding "VOID" it announces the error of "class delegate enum interface or expected struct"

how can i solve this problem?

 

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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 10, MinValue = 1)]
        public int StopLoss { get; set; }

        [Parameter("Volume", DefaultValue = 10000, MinValue = 1000)]
        public int Volume { get; set; }

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

        [Parameter("Take_Profit", DefaultValue = 75, MinValue = 10)]
        public int TakeProfit { get; set; }

     }
    



}
        protected override void OnStart()
        {
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 3);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 6);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 12);
        }








        protected override void OnTick()
        {
            if (_rsi.Result.LastValue < 40)
                if (_rsi2.Result.LastValue < 40)
                    if (_rsi3.Result.LastValue < 40)
                        Close(TradeType.buy);
            Open(TradeType.sell);

            if (_rsi.Result.LastValue > 60)
                if (_rsi2.Result.LastValue > 60)
                    if (_rsi3.Result.LastValue > 60)
                        Close(TradeType.Sell);
            Open(TradeType.Buy);
       
}
        
        
        

        protected override void OnStop()
        {
            private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType))
                ClosePosition(position);
        }

  private void Open(TradeType tradeType)
        {
            var position = Positions.Find("SampleRSI", Symbol, tradeType);

            if (position == null)
                ExecuteMarketOrder(tradeType, Symbol, Volume, "SampleRSI");
        }
        }
    }
}
 

 

 


@samuel.jus.cornelio