Posted By: Neb
Custom header function - 03/25/21 14:17
Hi,
Needed to create custom header function, which i put in include folder.
However, I am wondering if I can somehow optimise it even more, regarding how I call it.
in run I have:
vars Highs = series(priceHigh());
vars Lows = series(priceLow());
vars Opens = series(priceOpen());
vars Closes = series(priceClose());
Function is returning boolean and signature is like this:
bool Pattern(NumPattShortY,Highs,Lows,Closes,Opens);
Def part looks like this:
bool Pattern(int numeropattern,vars Highs, vars Lows, vars Closes, vars Opens)
{
bool PtnBaseSA;
switch(numeropattern)
{
case 1:
PtnBaseSA = abs(Opens[1]-Closes[1])<0.5*(Highs[1]-Lows[1]);
break;
case 2:
PtnBaseSA = abs(Opens[1]-Closes[5])<0.5*(Highs[5]-Closes[1]);
break;
case 3:
PtnBaseSA = abs(Opens[5]-Closes[1]) <0.5*(MaxVal(Highs,5) - MinVal(Lows,5));
break;
*
*
*
return PtnBaseSA;
}
My question is can I somehow cut this "Highs,Lows,Closes,Opens" in definition and call and change it with something shorter and more efficient (array of series ..?)?
And how then PtnBaseSA would change as well ?
Excuse me for my bad programming knowledge !
Thanks,
Neb
Needed to create custom header function, which i put in include folder.
However, I am wondering if I can somehow optimise it even more, regarding how I call it.
in run I have:
vars Highs = series(priceHigh());
vars Lows = series(priceLow());
vars Opens = series(priceOpen());
vars Closes = series(priceClose());
Function is returning boolean and signature is like this:
bool Pattern(NumPattShortY,Highs,Lows,Closes,Opens);
Def part looks like this:
bool Pattern(int numeropattern,vars Highs, vars Lows, vars Closes, vars Opens)
{
bool PtnBaseSA;
switch(numeropattern)
{
case 1:
PtnBaseSA = abs(Opens[1]-Closes[1])<0.5*(Highs[1]-Lows[1]);
break;
case 2:
PtnBaseSA = abs(Opens[1]-Closes[5])<0.5*(Highs[5]-Closes[1]);
break;
case 3:
PtnBaseSA = abs(Opens[5]-Closes[1]) <0.5*(MaxVal(Highs,5) - MinVal(Lows,5));
break;
*
*
*
return PtnBaseSA;
}
My question is can I somehow cut this "Highs,Lows,Closes,Opens" in definition and call and change it with something shorter and more efficient (array of series ..?)?
And how then PtnBaseSA would change as well ?
Excuse me for my bad programming knowledge !
Thanks,
Neb