Beginners Workshop

Posted By: danatrader

Beginners Workshop - 07/13/19 22:39

I thinking of some simple workshop to extend the workshops included in Zorro.

Well, I really want to learn it myself.

Therefore, I ask for your support.

I create a function for calculating WCL (I know it is included, but to learn it helps I guess, cause it's simple calculation).

function wcl()
{
vars c = series(priceClose());
vars l = series(priceLow());
vars h = series(priceHigh());
vars x = 1;
}


Now, however I want to make the calculation of WCL
https://www.tradesignalonline.com/lexicon/view.aspx?id=Weighted+Close+(WCL)

I get some syntax error: wrong type: e.g. DIV:POINTER:POINTER:POINTER.

So maybe someone could show me the way.
Posted By: Grat

Re: Beginners Workshop - 07/14/19 15:33

...from head

Code

var wcl(const int g=1){

   var w=(priceHigh()+priceLow()+g*priceClose())/(2*g);
   return w;
}

//use:

vars wclS=series(wcl(1));


Posted By: jcl

Re: Beginners Workshop - 07/15/19 06:29

An indicator workshop is a good idea.
Posted By: danatrader

Re: Beginners Workshop - 07/20/19 07:11

To rephrase, I am a beginner, but I am willing to work hard, so if anyone helps, I will document my learning and compile the process, making Zorro accessible to medium skilled people that just won't give up.
Posted By: danatrader

Re: Beginners Workshop - 07/20/19 07:54

So I got something, and I will anyway never use the answers given, otherwise learning effect would be zero, I got soemthing that compiles.
I have no idea if it is correecxt, but it compiles.

function wcl()
{

var weight = 1;
var high = priceHigh();
var low = priceLow();
var close = priceClose();

var calc = high+low+weight*close/(2+weight);
return calc;

vars wclS=series(wcl());

}

Now I want to call the function to visualise what it may or may not calculate.
The function is embedded in Workshop7.

Within the main run() I have

wcl();
plot("WCL",wcl(),0,BLUE);

How would I correctly plot the bars showing the WCL like shown here?
https://zorro-project.com/manual/en/plot.htm
Posted By: Grat

Re: Beginners Workshop - 07/21/19 15:10

Hi,

in your code is bug:

function wcl()
{

var weight = 1;
var high = priceHigh();
var low = priceLow();
var close = priceClose();

var calc = high+low+weight*close/(2+weight);
return calc; <--- return var calc

vars wclS=series(wcl()); <- this never going - is after return, this must by in FCE run()

}

your question:
in the FCE run:

set(PLOTNOW);
vars wclS=series(wcl());
..
plot("WCL indi ", wclS, NEW+LINE, BLUE);

or in main window
plot("WCL indi ", wclS, MAIN+LINE, BLUE);
© 2024 lite-C Forums