I am working on creating a strategy and I'm trying to get the code working. I am using code developed in Pinescript (TradingView) and trying to convert it into working code for C# (NinjaTrader). I have gotten the current version of my code down to 4 errors, but I don't understand enough about C# to troubleshoot them. This is my first attempt at C# but I've done a little Python and C++ programming. Thanks in advance for any help you can provide.
----------------------------------
81 int p = 10; //ATR Length (p) ***No longer an input, set in code, fix later?
82 int x = 1; // ATR Coefficient (x) ***No longer an input, set in code, fix later?
83 int q = 9; //Stop Length (q) ***No longer an input, set in code, fix later?
84 double A_T_R = ATR(p)[0];
85 Series<double> first_high_stop;
86 Series<double> first_low_stop;
87
88
89 first_high_stop[0] = HighestBar(High, p) - x * A_T_R;
90 first_low_stop[0] = LowestBar(Low, p) + x * A_T_R;
91 double stop_short = HighestBar(first_high_stop, q);
92 double stop_long = LowestBar(first_low_stop, q);
93 //plot(stop_long, color=#2962FF, title="Stop Long"); ***Figure out plots later
94 //plot(stop_short, color=#FF6D00, title="Stop Short"); ***Figure out plots later
95
96
97
98 int length1 = 32;
99 int offset = 0;
100 double src = Close[0];
101 double lsma = LinReg(src, length1)[offset];
102 double lsma2 = LinReg(lsma, length1)[offset];
103 double eq = lsma-lsma2;
104 double zlsma = lsma+eq;

Comment