[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] How to create a synthetic OHLC ?



PureBytes Links

Trading Reference Links


Hi MG,

Many thanks for the code and your explanations :)

Regards,

Marco



MG Ferreira a écrit :
Hi Marco,

The code gives two versions, one that is based on a chosen indicator
(T1 or T2) that you can define as you wish and another that uses the
ticker's open/high/low/close in stead.  You have to choose which one
you want and delete the rest.  Also, yes! it does not display
anything, simply calculate the relevant bar's O/H/L and C.  

So it really just calculates the bar.  To display the say first bar,
add a line like this to the bottom:

B1O;B1H;B1L;B1C

which will then plot the first bar's open, high, low and close.  Note
that the plot will display four lines, not a real bar as you probably
want.  But the idea is there somewhere....  You can format the lines
into something different, say dots, but not into a bar - at least not
in the MS I am using.

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 


--- In equismetastock@xxxxxxxxxxxxxxx, khamsina11 <Khamsina11@xxxx> wrote:
  
Hi MG,

Many thanks for the code but unfortunately it does not display.

Did I make a mistake somewhere ?

Regards,

Marco


MG Ferreira a écrit :

    
Marco,

I've quickly tested the code, using the Cum(1) function, and made
a few adjustments....  Herewith the same stuff, but with a few bugs
fixed!  Note that there may remain some more, so now is a good time
to read the disclaimer....

Anyhow, hope this is closer to the mark.  Also, see the note at the
end.

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 

----8<----------------------------------------------------------------
{Create two custom sized bars
Results in B1O/H/L/C and B2O/H/L/C
For personal use only
MG Ferreira
http://www.ferra4models.com
http://fun.ferra4models.com
}

{Indicators we wish to filter, replace with your stuff
Could be the same, i.e. T2 := T1
}
T1 := RSI(14);
T2 := RSI(14);

{Bar lengths}
N1 := Input("First bar length",1,9999,5);
N2 := Input("Second bar length",1,9999,45);

{Counters we need}
II := Cum(1) - 1;

{Counters for N1}
M1 := Mod(II,N1);
J1 := M1 = (N1-1);
K1 := M1 = 0;

{Counters for N2}
M2 := Mod(II,N2);
J2 := M2 = (N2-1);
K2 := M2 = 0;

{Construct N1 bar from indicator T1}
B1O := Ref(Sum(T1*K1,N1),-N1+1);
B1H := Sum(HHV(T1,N1)*J1,N1);
B1L := Sum(LLV(T1,N1)*J1,N1);
B1C := Sum(T1*J1,N1);

{Construct N1 bar from ticker O/H/L/C}
B1O := Ref(Sum(OPEN*K1,N1),-N1+1);
B1H := Sum(HHV(HIGH,N1)*J1,N1);
B1L := Sum(LLV(LOW,N1)*J1,N1);
B1C := Sum(CLOSE*J1,N1);

{Construct N2 bar from indicator T2}
B2O := Ref(Sum(T2*K2,N2),-N2+1);
B2H := Sum(HHV(T2,N2)*J2,N2);
B2L := Sum(LLV(T2,N2)*J2,N2);
B2C := Sum(T2*J2,N2);

{Construct N2 bar from ticker O/H/L/C}
B2O := Ref(Sum(OPEN*K2,N2),-N2+1);
B2H := Sum(HHV(HIGH,N2)*J2,N2);
B2L := Sum(LLV(LOW,N2)*J2,N2);
B2C := Sum(CLOSE*J2,N2);

{Note: contains some lag, to take out the lag, use
*****

B1OL := Ref(B1O,N1-1)
B1HL := Ref(B1H,N1-1)
...
Note: this introduces some look ahead, as the formula
      now 'sees' what the high/low/close of the current
      bar will be before we get to the end of it
}

----8<----------------------------------------------------------------







Yahoo! Groups Links








 

      





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




  

Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links