Profile Picture

Re-coding a RE sample

Posted By mokka 3 Years Ago
Message
Posted Saturday July 19 2014
Hi all,
on the path to understand how RE logic works, I've coded a simple moving average indicator, starting from a sample provided in the Samples folder (SMASample1.cs). Proceeding by trial and error, I found something that seems to go well, on chart and in simulating a strategy. But I have had to change the original CalcNewValue implementation, here below:

protected override double CalcNewValue(int index)
{
   if (index < _periods - 1)
    {
return double.NaN;
    }

double sum = 0.0;
for (int i = index - _periods + 1; i <= index; i++)
      {
sum += inputs[0][i];
      }

      return sum / _periods;
      
}

with the following:

protected override double CalcNewValue(int index)
{
if (this.Count < _periods - 1)
{
return double.NaN;
}

double sum = 0.0;
for (int i = 0; i < _periods; i++)
{
sum += inputs[0].LookBack(index + i);
}

return sum / _periods;
}

The question is: is it my updated version coded as expected in the current version of RE ? If the example provided by RE is out of date, is it possible to refer to better documentation and avoid to reinvent the wheel ? BigGrin

Thank you in advance
Posted Friday July 25 2014
I don’t have time to go through your code or test it - maybe Daniel does - but the RightEdge documentation is pretty good (api reference, manual, forums) and while I’ve had questions (and still do) about code execution, it can always be resolved by using the debugger in Visual Studio - you need to do this anyway - or by asking specific questions via the forums.

If you do see issues or concerns in the samples, please let RightEdge know, as you just did.

I posted the following a few days ago - http://www.rightedgesystems.com/forums/Topic15571-9-1.aspx - but I think it is worth mentioning in this post.

Duane

Edited: Friday July 25 2014 by alpha23
Posted Friday July 25 2014
Thank you, Duane.
I'm using Visual Studio and RE API reference as main guide. I agree with you: you have great control over the code. From my standpoint, after a month of observing, reading and asking, there're few users on the forum and it doesn't seem a real resource when someone asks for help. Also, documentation is not good enough for a product so technical and complex: for your advise, I'm trying to understand how Paper Trader works under the hood, but there's no a specific reference to check, so discovering as much as possible about it will be my job for the next days ... my sense as a beginner is that RE is a great product, with a solid philosophy and a lot to offer to a good programmer: the learning curve is a little bit steep.

Thank you for reading


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems