declaration incorrect
declaration incorrect
11 May 2020, 00:58
The index information to calculation is wrong and I need to help to solve.
Please, can you check to me?
tks
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.IO;
using System.Text;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Rotinacomcorrecaodecurvas : Robot
{
[Parameter(DefaultValue = 1)]
public double VolumeToOpenOrders { get; set; }
[Parameter(DefaultValue = 40)]
public int TakeProfitInPips { get; set; }
[Parameter("Stop Loss", DefaultValue = 40)]
public int StopLoss { get; set; }
[Parameter("Hora Abertura", DefaultValue = 12)]
public int LastValue { get; set; }
[Parameter("Indice da Curva", DefaultValue = 15.0)]
public int Period { get; set; }
[Parameter("Tamanho da reta", DefaultValue = 18.0)]
public int Parameter { get; set; }
protected override void OnBar()
{
if (Bars.OpenTimes.LastValue.Hour == LastValue)
{
// public override void Calculate(int index)
var wad = Indicators.WilliamsAccumulationDistribution();
var lrs = Indicators.LinearRegressionSlope(wad.Result, Period);
var res = Bars.ClosePrices[index] + lrs.Result[index];
{
if (res.Result.LastValue > res.Result.Last(Parameter))
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
}
{
if (res.Result.LastValue < res.Result.Last(Parameter))
ExecuteMarketOrder(TradeType.Sell, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
{
}
}
}
}
}
}
Replies
eliezer_barros
11 May 2020, 15:56
RE:
PanagiotisCharalampous said:
Hi Eliezer,
It is not clear what your problem is. You need to provide a better explanation.
Best Regards,
Panagiotis
Hi,
The information is "the name index does not exist in the current context".
var res = Bars.ClosePrices[index] + lrs.Result[index];
I am trying to use this routine that was to create graphics to calculate and reproduce the same information that graphics.
thank for your help
@eliezer_barros
PanagiotisCharalampous
11 May 2020, 16:04
Hi Eliezer,
As the message suggests, there is no variable named index declared. It seems you are just copying and pasting code. You need to understand what you are doing. What is the index supposed to do?
Best Regards,
Panagiotis
@PanagiotisCharalampous
eliezer_barros
11 May 2020, 16:10
RE:
PanagiotisCharalampous said:
Hi Eliezer,
As the message suggests, there is no variable named index declared. It seems you are just copying and pasting code. You need to understand what you are doing. What is the index supposed to do?
Best Regards,
Panagiotis
As you can see in the routine, I left the declaration of the variable in stand by (//) because when I put it to use, other messages appear and as I don't master this language, msn doesn't make sense to me.
tks
@eliezer_barros
PanagiotisCharalampous
11 May 2020, 16:40
Hi Eliezer,
There is no declaration of the index variable anywhere, the commented code seems to be a function declaration probably copied from an indicator. It it obvious that you lack basic programming skills and that you tried to copy and paste code without really understanding what you are doing. I would suggest you contact a professional to help you with your project instead of trying yourself.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 May 2020, 08:49
Hi Eliezer,
It is not clear what your problem is. You need to provide a better explanation.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous