Hi,

I had an idea that "almost" solved the problem: to use some arrays shifted of N 
days to "built" the week.

I post here the code to share it and to catch suggestion to solve the problem 
that it still exists: having used in not normal way the timeframecompress 
function there are problems in weeks with less than 5 trading days like Xmas 
period. Of course it's not a problem of AB, it's more a misuse of the function.

The product is a composed graph with 5 colors bar (one every 5 days) and also a 
black dashed line that show the problem occuring in period like Xmas

I hope it could help giving an (maybe wrong) idea and not produce confusion in 
the use of AB timeframe functions

PS I also had to code a function to calculate MACD on an array because the 
built in function uses always C


function MACDmy( array, Sh, Lo )
{
    eSh = EMA( array, Sh );
    eLo = EMA( array, Lo );
    return eSh -eLo;
}

function SignalMy( array, smooth )
{
    return EMA( array, smooth );
}


function HistMACD( array, Sh, Lo, Smooth )
{
    m = MACDmy( Array, Sh, Lo );
    s = SignalMy( m, smooth );
    return m - s;
}


Ar0 = TimeFrameCompress(Ref(C,-0), 5*inDaily,compressLast);

HMACD0 = TimeFrameExpand(HistMACD(Ar0,12,26,9), 5*inDaily,expandPoint  );


Ar1 = TimeFrameCompress(Ref(C,-1), 5*inDaily,compressLast);

HMACD1 = TimeFrameExpand(HistMACD(Ar1,12,26,9), 5*inDaily ,expandPoint  );


Ar2 = TimeFrameCompress(Ref(C,-2),5*inDaily,compressLast);

HMACD2 = TimeFrameExpand(HistMACD(Ar2,12,26,9), 5*inDaily,expandPoint  );


Ar3 = TimeFrameCompress(Ref(C,-3),5*inDaily,compressLast);

HMACD3 = TimeFrameExpand(HistMACD(Ar3,12,26,9), 5*inDaily,expandPoint  );


Ar4 = TimeFrameCompress(Ref(C,-4),5*inDaily,compressLast);

HMACD4 = TimeFrameExpand(HistMACD(Ar4,12,26,9), 5*inDaily,expandPoint  );



Plot( HMACD0, "Weekly MACDmy Histogram",  colorPink, styleArea | styleNoLabel, 
Null, Null, Null, -1 );

Plot( Ref(HMACD1,1), "Weekly MACDmy Histogram",  colorGreen, styleArea | 
styleNoLabel, Null, Null, Null, -1 );

Plot( Ref(HMACD2,2), "Weekly MACDmy Histogram",  colorOrange, styleArea | 
styleNoLabel, Null, Null, Null, -1 );

Plot( Ref(HMACD3,3), "Weekly MACDmy Histogram",  colorPaleGreen, styleArea | 
styleNoLabel, Null, Null, Null, -1 );

Plot( Ref(HMACD4,4), "Weekly MACDmy Histogram",  colorGrey50, styleArea | 
styleNoLabel, Null, Null, Null, -1 );

tot = Nz(HMACD0) + Nz(Ref(HMACD1,1))  + Nz(Ref(HMACD2,2)) + Nz(Ref(HMACD3,3)) + 
Nz(Ref(HMACD4,4)); 


Plot( tot , "Weekly MACDmy Histogram",  colorBlack, styleDashed | styleNoLabel, 
Null, Null, Null, 1 );


--- In [email protected], "m.csabee" <m.csa...@...> wrote:
>
> Greetings all,
> 
> 
> Most charting softwares that I&#8217;ve seen always show the weekly charts of 
> the end of a week, usually Friday.But who says that a week must end every 
> Friday?Must a weekly chart reflect only the latest five days of trading every 
> Friday?I think a proper weekly chart should be one that is set up to reflect 
> one action that is one magnitude greater than the daily chart.It should 
> display its latest price bar to always reflect where prices are relative to 
> the latest 5 days of trading.It changes every day to reflect the latest 5 
> days of trading.
> I would use Stochastic %D on my trading system.
> Is it possible somehow to change the last close price every day (get the 
> recent close price in stochastic formula) and recalculate the weekly 
> stochastic value each day?
> And is it possible to appear this weekly Stochastic and daily Stochastic in 
> same window?I would use daily price chart with second window with 2 timeframe 
> indicator below.
> 
> thanks for all help
> Regards
>


Reply via email to