Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am using Multicharts .NET64. Unfortunately or fortunately, MC.NET supports C# and VB. The .NET version does not support easy language so I am forced to use the OO construct.
I understand programming and a bit of OO, but by far not a hard core programmer (although I pretend to be one during the day).
I am having a bit of trouble with some of the errors being thrown. Looks like a type mismatch in my coding, but I just "don't get it"..
Getting error "Cannot Implicitly convert type 'DOUBLE' to PowerLanguage.ISeries<double>'...
My intent with the signal is to create an Avg of an already calculated value.
The entire code is here with the line in question highlights in RED.
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator{
public class ZJZ_OpenCloseTrend_Avg_001 : IndicatorObject {
private AverageFC m_AverageFC;
public ZJZ_OpenCloseTrend_Avg_001(object _ctx):base(_ctx)
{
// assign default values to inputs
length = 8;
}
// define the inputs
[Input]
public int length { get; set; }
private IPlotObject Open_Close_Trend;
public interface IAlert
{
bool CheckAlertLastBar { get; } // true if it is the last bar now
bool Enabled { get; } // true - if alerts are on
void Alert(); // to generate Alert with an empty text
void Alert(string Format, params object[] _args); // generate alert with message.
void Cancel(); // finish Alert generation on this bar.
}
reviewing other sample codes from other indicators.. Looks like if I just eliminate the Double Type definitions, that will keep the types and assignments consistent... A bit of rework is in order..
You're setting the `price` property of your `AverageFC` instance to a double value:
That `price` property, however, requires a series of a values to compute on, and not a single double value. This kind of makes sense when we think about what the `AverageFC` function does: computing the average from a range of different values. And to do that, it needs at least two different values to calculate the average of.
In normal English, what you're trying to do here is calculating the 8-bar average value of a single value (like 103.05, or whichever value `trend` has).
Yes, I understand what you are saying. I am having a hard time discerning what applies to double series, etc. and the correct syntax. I have tried several permutations. As well as tried to use the same approach as the standard Mov_Avg_1_Line study. In that follows the same construct of taking multiple individual values and then average them:
protected override void CalcBar(){
m_avg.Value = m_averagefc1[0];
if (displace >= 0 || Bars.CurrentBar > Math.Abs(displace)){
Plot1.Set(displace, m_avg.Value);
if (displace <= 0){
if (this.CrossesOver(price, m_avg)){
Alerts.Alert("Price crossing over average");
}
....
Technically the Price should not care what value is given it, no? Wouldn't I be able to just pass 'trend' and 'length' to m_averagefc1.price and m_averagefc1.length respectively. Or just assign 'trend' to m_avg.Value...