- ago
I'm just starting to write some c# strategies. I lifted this code directly from the sample in the quickref but it is giving me an error. It does not like SROC. Error message: "Compiled at 11/19/2024 12:52:33
26: The type or namespace name 'SROC' could not be found (are you missing a using directive or an assembly reference?)
16: The type or namespace name 'SROC' could not be found (are you missing a using directive or an assembly reference?)"

What am i doing wrong?

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic;    namespace WealthLab    {       public class MyStrategy2 : UserStrategyBase       {          //create indicators and other objects here, this is executed prior to the main trading loop          public override void Initialize(BarHistory bars)          {             indicator = new SROC(bars.Open, 4);             PlotIndicator(indicator);          }          //execute the strategy rules here, this is executed once for each bar in the backtest history          public override void Execute(BarHistory bars, int idx)          {          }          //declare private variables below          private SROC indicator;       }    }
0
77
Solved
5 Replies

Reply

Bookmark

Sort
- ago
#1
The SROC() indicator is part of the finantic.Indicator extension. To make it work you need
1. this extension installed
2. write a "using finantic.Indicators" at the beginning of your code.

TIP:
To get started with C# coding it is a good idea to let WL produce some C# code for you to learn all the details.
In this case: Open a Chart, drag the SROC indicator on the Chart and go:
right-mouse-click->Push dropped indicators to new C# coded strategy window

This will open some working C# code....
0
Best Answer
- ago
#2
Thank you! i was about to post that i found that i was missing finantic.Indicators line. Thanks for the prompt reply!
0
- ago
#3
I tended to think I am the "oldest veteran" here.
Just found out that this is not true.

soulaerius, good to see you here again...
0
- ago
#4
Haha, after the move to fidelity I dropped out and wandered in the land of TradeStation, amibroker and python. I like this platform and am slowly moving my production strats to it. Great community here too!
1
Glitch8
 ( 10.83% )
- ago
#5
Glad to see you back again!
0

Reply

Bookmark

Sort