Help converting a Pine Editor indicator (BBW) - futures io
futures io futures trading



Help converting a Pine Editor indicator (BBW)


Discussion in MultiCharts

Updated by alex20037
    1. trending_up 797 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Help converting a Pine Editor indicator (BBW)

(login for full post details)
  #1 (permalink)
Miami Lakes
 
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
 
Posts: 19 since Oct 2016
Thanks: 2 given, 3 received

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.

Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > Help converting a Pine Editor indicator (BBW)


January 11, 2017


Upcoming Webinars and Events
 

Every journal equals ten meals for the hungry

Now
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts