NexusFi: Find Your Edge


Home Menu

 





Help converting a Pine Editor indicator (BBW)


Discussion in MultiCharts

Updated
    1. trending_up 1,942 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

Help converting a Pine Editor indicator (BBW)

  #1 (permalink)
 alex20037 
Miami Lakes
 
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks Given: 2
Thanks Received: 3

I see TradingView had this indicator I'd like to use in Multicharts, it is called BBW and this is the code:

length = input(20, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)

basis = sma(src, length) //This seems to be the line I am having problems with

dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
bbw = (upper-lower)/basis
plot(bbw, color=blue)

This is what I am trying to build in Multicharts .NET:

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator{
public class BBW : IndicatorObject {
public BBW(object _ctx):base(_ctx){
std = 2;
length = 20;
}
private IPlotObject plot1;

[Input]
private int std { get;set; }

[Input]
private int length { get;set; }

protected override void Create() {
// create variable objects, function objects, plot objects etc.
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
}

protected override void StartCalc() {
// assign inputs
}

protected override void CalcBar(){
// indicator logic
var basis = AverageFC(Bars.CloseValue,length);
var dev = std * Bars.Close.StandardDeviationCustom(length,1);

plot1.Set( ( (basis+dev) - (basis-dev) )/basis );
}
}
}

When compiling it returns this error:
'PowerLanguage.Function.AverageFC' is a 'type' but is used like a 'variable' "BBW" [Indicator] Ln 31.

which comes from the line:
var basis = AverageFC(Bars.CloseValue,length);

What would be the right way to assign this variable "basis" its value please? The value should be the simple moving average over the last "length" close values.


As always any help is really appreciated, thank you.

Started this thread Reply With Quote




Last Updated on January 11, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts