Need your help in multitimeframe

cheap

Active Member
#41
cool, i got it's mr. karthick ?

Yes, that problem I'm still solving, Number is not getting placed, my meaning numbers are moving with candles. it should be at right place , when it's first originated

like,
if 5 on 5candles .. it's also moving with when price candle is for example i.e. current cnadle...
it has to be there at first place, and if new value it should be at right place..


picture:


regards
You might add few things like .. if those digits under bar more than 1 ,
two times .. then put a dot sign?
or
If in last 3 bars more than 1 digits under bar, which means it could be
2 different digits between two candles .. if such thing put dot on last bar..
Isn't it ?
for(b=1; b<BarCount;, b++)


up ---> that bar .. only bar true ..

i for timeframe .. so under candle digits more one .. Under candle.. you need to use Count function i guess.. that will count how many digits do you have candlessticl..
if that is more than 2 ... put dot there .. that means plotshapes


It's not stable with price.. maybe because .. need to add something
if that candlestick on that tf made under current tf chart .. which simply means digit. don't move it ..
wait wait wait ..
you using for loop
you want it only one time on cadlestick .. dont move around with price..
for that you need to use while loop..
or break statement under for loop.. that terminal something like that ..
but YOU HAVE TO USE FOR LOOP WITHOUT THAT HOW DO YOU GONNA GET TIMEFRAME ..

IN YOUR plottext statemet .. you need to use while loop inside it like
or ??
 
#42
You might add few things like .. if those digits under bar more than 1 ,
two times .. then put a dot sign?
or
If in last 3 bars more than 1 digits under bar, which means it could be
2 different digits between two candles .. if such thing put dot on last bar..
Isn't it ?
for(b=1; b<BarCount;, b++)


up ---> that bar .. only bar true ..

i for timeframe .. so under candle digits more one .. Under candle.. you need to use Count function i guess.. that will count how many digits do you have candlessticl..
if that is more than 2 ... put dot there .. that means plotshapes


It's not stable with price.. maybe because .. need to add something
if that candlestick on that tf made under current tf chart .. which simply means digit. don't move it ..
wait wait wait ..
you using for loop
you want it only one time on cadlestick .. dont move around with price..
for that you need to use while loop..
or break statement under for loop.. that terminal something like that ..
but YOU HAVE TO USE FOR LOOP WITHOUT THAT HOW DO YOU GONNA GET TIMEFRAME ..

IN YOUR plottext statemet .. you need to use while loop inside it like
or ??


Yes, read it yesterday, implementing it ...
good points, I've bit more advance and good ideas .. probably add more in it, btw,



regards
mtftraders
 
Last edited:
#43
A beautiful Soul try to solve this problem(thanks to him)
but it's not working rightly.





What is the problem?
See this picture: http://imgur.com/7s9QhHb






HOW TO BELIEVE IT'S NOT PLOTTING RIGHT

SEE THOSE TWO UPPER PICTURE in BELOW LINK..
http://i.imgur.com/Tqfj57H.webm
GH


Kindly take my 2 week research for free
:)
see below:
Code:
for(i=1; i<=3; i++) {

   TimeframeSet(i * in1Minute);

   bar = C > O ;

  TimeframeRestore();
m = TimeFrameExpand(up,in1Minute*i);

for(b=1; b<BarCount;, b++)
{
 if(bar[b] == True)
 PlotText(""+(i), b, L[b]-2-(i), colorAqua);

}
}
//PlotShapes(up[i]*shapeCircle,colorRed);
Plot(C, "",colorblack, styleCandle); //For seeing chart

_N(Title = StrFormat("{{NAME}} -"+ EncodeColor(colorBlue)+""+
EncodeColor(colorBlue)+" {{INTERVAL}} "+
EncodeColor(colorWhite)+"{{DATE}} \n Op=> %g, \n Hi=> %g, \n Lo=> %g,
\n Cl=> %g,
 {{VALUES}}", O, H, L, C  ));
KINDLY GIVE YOUR OPINION
 
Last edited:
#44
This is the code from Numbering bar amibroker site.

I do think , there's some issue with it.

frOM AMIBROKER WEBSITE KNOWLEDGE BASE ..

Code:
Plot(C,"",1,128); 
_SECTION_BEGIN("BAR LABELING"); 
ShowBars = ParamToggle("Label Bars","NO|YES",0);
LabelCo = ParamColor("Label",colorYellow);
Label = ParamList("Bar Label","NUMBER|TIMENUM|DATENUM",0); 
GraphXSpace = 10; 
if( Showbars ) 
{ 
DN=DateNum(); 
TN=TimeNum(); 
FirstVisibleBar = Status( "FirstVisibleBar" ); 
Lastvisiblebar = Status("LastVisibleBar");  
for( b = Firstvisiblebar, BN=0; b <= Lastvisiblebar AND b < BarCount; b++) 
{ 
if( Label == "NUMBER" ) BarLabel = NumToStr(BN++,1.0); 
else if ( Label == "TIMENUM" ) BarLabel = NumToStr(TN[b],1.0); 
else BarLabel= NumToStr(DN[b],1.0); 
PlotText("\n^\n"+BarLabel,b,L[b],LabelCo); 
} 
} 
_SECTION_END();
_SECTION_BEGIN( "BAR LABELING" );
Plot( C, "", 1, 128 );
ShowBars = ParamToggle( "Label Bars", "NO|YES", 0 );
LabelCo = ParamColor( "Label", colorYellow );
Label = ParamList( "BarLabel", "NUMBER|TimeNum|DateNum|BARNUM|WEEKDAYNUM|WEEKDAY", 0 );
GraphXSpace = 10;

if ( Showbars )
{
    DN = DateNum();
    TN = TimeNum();
    WD = DayOfWeek();
    WDList = "SUN,MON,TUE,WED,THU,FRI,SAT";
    FirstVisibleBar = Status( "FirstVisibleBar" );
    Lastvisiblebar = Status( "LastVisibleBar" );

    for ( b = Firstvisiblebar, BN = 0; b <= Lastvisiblebar AND b < BarCount; b++ )
    {
        switch ( Label )
        {
            case "NUMBER":
                BarLabel = NumToStr( BN++, 1.0 );
                break;
            case "TIMENUM":
                BarLabel = NumToStr( TN[b], 1.0 );
                break;
            case "BARNUM":
                BarLabel = NumToStr( b, 1.0 );
                break;
            case "WEEKDAYNUM":
                BarLabel = NumToStr( WD[b], 1.0 );
                break;
            case "WEEKDAY":
                BarLabel = StrExtract( WDList, WD[b] );
                break;
            default:
                BarLabel = NumToStr( DN[b], 1.0 );
                break;
        }
        PlotText( "\n^\n" + BarLabel, b, L[b] - ( H[b] - L[b] ), LabelCo );
    }
}
_SECTION_END();
THIS CODE IS INTEND TO NUMBERING UNDER BARS ..
PICTURE:


FOR PROOF IT'S BEHAVING SAME WAY AS MY PAST CODE:


http://imgur.com/p8JrpCP

LINK WILL SHOW YOU , HOW IS IT BEHAVING ? SEE VALUES I.E. LAST 8,9,10 IT'S MOING WITH CANDLES. NOT PROPERLY ALIGNED WITH BARS ..SEE THE LINK ..

DOES ANYONE KNOW? WHY THESE VALUES ARE NOT PROPERLY ALIGNED WITH BARS ?
LET US KNOW WHY OFFICIAL CODE WORKING LIKE THAT.. WHAT DO WE NEED TO DO TO FIX VALUES ALIGNED ON BARS , NOT MOVE LIKE IT IS MOVING IN PICTURE.
IS THIS INHERENT PROBLEM ?

regards
mtftrader
 
Last edited:
#45
A beautiful Soul try to solve this problem(thanks to him)
but it's not working rightly.





What is the problem?
See this picture: http://imgur.com/7s9QhHb






HOW TO BELIEVE IT'S NOT PLOTTING RIGHT

SEE THOSE TWO UPPER PICTURE in BELOW LINK..
http://i.imgur.com/Tqfj57H.webm
GH


Kindly take my 2 week research for free
:)
see below:
Code:
for(i=1; i<=3; i++) {

   TimeframeSet(i * in1Minute);

   bar = C > O ;

  TimeframeRestore();
m = TimeFrameExpand(up,in1Minute*i);

for(b=1; b<BarCount;, b++)
{
 if(bar[b] == True)
 PlotText(""+(i), b, L[b]-2-(i), colorAqua);

}
}
//PlotShapes(up[i]*shapeCircle,colorRed);
Plot(C, "",colorblack, styleCandle); //For seeing chart

_N(Title = StrFormat("{{NAME}} -"+ EncodeColor(colorBlue)+""+
EncodeColor(colorBlue)+" {{INTERVAL}} "+
EncodeColor(colorWhite)+"{{DATE}} \n Op=> %g, \n Hi=> %g, \n Lo=> %g,
\n Cl=> %g,
 {{VALUES}}", O, H, L, C  ));
KINDLY GIVE YOUR OPINION


As i try to explain simple as possible, I try to add one more picture..

 

cheap

Active Member
#47
I guess picture says it all ...

if anyone has done such kinda work before, let us know ..

IN all timeframes, signals should be same as black line ..



http://imgur.com/ejjcbDA

IT'S NOT WHOLE CANDLE SIGNAL
you know, lines like yesterday high low open close, something like that ..
when it's plotted on today's chart / currrent day
chart ..
yes it meet your criteria like ..
it could be middle of the candle .. whatever timeframe you seeing..
and it doesn't change vales as you change timeframe..



Code:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_BEGIN("Title");
DDayO = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily); 
DLoDay = TimeFrameGetPrice("L", inDaily);
prvC = TimeFrameGetPrice("C", inDaily, -1);//close 
Title =EncodeColor(colorBlue)+ Date()+EncodeColor(colorRed)+"   "+Interval(format=2)+EncodeColor(colorGreen)+"    "+Name()+EncodeColor(colorOrange)+"      Open:"+WriteVal(O,1.2)+EncodeColor(colorBlue)+"     High: "+WriteVal(H,1.2)+EncodeColor(colorRed)+"       Low: "+WriteVal(L,1.2)+EncodeColor(colorGreen)+"        Close "+
			WriteVal(C,1.2) + 
      "              @  Prev Close  :  " + EncodeColor(colorBlack) + prvC +EncodeColor(colorCustom12)+ 
"\n Day-Open : " +DDayO + "  Day-High : " +DHiDay + "  Day-Low : "+  DLoDay ;    

_SECTION_END();

_SECTION_BEGIN("Price Line");

//PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 ); 

Daysback    = Param("Bars Back",100,10,500,1); 
FirstBar    = BarCount - DaysBack; 
YY          = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null); 

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel|styleThick,maskAll)); 

DayH = TimeFrameGetPrice("H", inDaily, -1);    DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);    DayLI = LastValue (DayL,1);   // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1);    // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);    // current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low
DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low

numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

[COLOR="RoyalBlue"]YHL = ParamToggle("Yesterday HI LO","Show|Hide",1);
if(YHL==1) {
Plot(DayL,"YL",colorAqua,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Plot(DayH,"YH",colorGreen,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorGreen);
PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorAqua);[/COLOR]
}
you can try and see it..

But if you use timeframeexpand such kind of mtf formula .. how do you adjust that stuff.. i got no idea ..main stuff code is like 20 lines only.
rest is just GfX painting kinda thing ..

If you have new idea, kindly share ..

and yes , your candle numbering problem i guess is solved, but if you go few little step further like mixing many stuff, with loop it's not done ..
I guess you already solved it.

i guess in mine one, i have to do something like this.. so that thing aren't gonna repaint..

Can't you do like ..
After making your formula .. instead of using candle.. just use close of candle ... right?
and use that close of candle ..fix it on horizontal line like this .. and adjust it to every timeframe.. it will be far far better ....or .... ??

it was a big afl, main stuff that's useful for you, did it here .. .yes, there was no link,....before someone bursts
 
Last edited:

cheap

Active Member
#48
I forgot to tell you that , by loop that not working because identifier only
support one dimension..

With help of Varset/Varget you can get two dimensional, code looks bit weird .. matrix same like mathematical matrix topics that you might have read .you can use that too ... i didn't used that, only example i can see row and column , not with trading indi....

i would like to do stuff like in normal way ,if something add multi d in this , it looks good . if it slows down code , then it's big worry .. if it's not slowing much , i guess it is ....

look this ..


you might be thinking , what j is doing here?
i for tf, b for barcount but this barcount is for your tf under bar,
barcount also gonna be used for 1 candlebefore or 2 candle before bart[j-1], bar[j-2]..in such way.. so it will be used more time ,take second barcount subscript as j,of course i have to change code in such way ...but it gonna be in same way, i didn't see any afl where two barcount is used in subloop though...let's see how it goes..

it was just intial ideas and guess what ? I can't do it by normal way ..

it will go up to like [][][][][] so they might call it 5 dimensional[/B]way ..
you need to make 5 or 6 subloops i guess ..
i was just started and like.. why is that happening?
Simple, because you can't do it by just make a loop 2 times .. one for tf two for barcount.. and do your calculation..
not gonna work..
 
Last edited:
#49
Yes, i want such kind of horizontal line ..
But there is issue, it does move before it is fix .. I don't want that..
Code:
Plot( C, "Price", colorDefault, styleCandle );
DayH = TimeFrameGetPrice("H", inHourly, 0);  

Plot(DayH,"",colorAqua,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
Try to use it for Intraday, as it's inHourly

problem is .. if you are watching 10 min. chart.. 6candle will be there..
it will move with 6 candles as soon it's completed, it's get fixed..

I don't want to see it's moving with candles..i want it when candle get hourly high, it just plot it .. that's all
 

cheap

Active Member
#50
while i'm trying with looping , i thought i share this .
if you wanna solve your further, you must know ,how to solve things in multi dimensional ..
what i mean simply is [][][]....how to solve such things..varset/varget for 2 dimensional..btw i have yet to see any afl which has
Code:
// Least Squares Channel Indicator
// Amibroker AFL code by E.M.Pottasch, Aug 2015
// Indicator updates at end of each bar or when parameters are adjusted
// Else press "Force Calculation" in parameter window
*
Version( 6 ); // need Amibroker version 6
SetBarsRequired( 1000, 0 );
*
order = Param( "n-th Order", 1, 1, 10, 1 );
clevel = Param( "Confidence Level", 2, 1, 3, 0.1 );
extend = Param( "Extend Fit (Bars)", 10, 0, 20, 1 );
trig = ParamTrigger( "Force Calculation", "Press Here" );
minbars = Param( "Minimum", 20, 1, 500, 1 ); // minimum number of bars before new channel starts
showTrack = ParamToggle( "Show Track", "No|Yes", 0 );
showSignals = ParamToggle( "Show Signals", "No|Yes", 0 );
*
s1 = GetChartID() + StrToNum( Name() );
*
regext = regextx1a = regextz1a = Null;
prc = ( H + L ) / 2;
sd = 0;
bi = BarIndex();
lvb = LastVisibleValue( bi );
fvb = 1;
*
function NewBarJustArrived()
{
****vname = "lbe" + s1;
****prev = Nz( StaticVarGet( vname ) );
****curr = Status( "lastbarend" );
*
****StaticVarSet( vname, curr );
*
****return curr != prev;
}
*
StaticVarSet( "DoEntirecalculation" + s1, 0 );
*
if( Nz( StaticVarGet( "svOrder" + s1 ) ) != order OR
********Nz( StaticVarGet( "svClevel" + s1 ) ) != clevel OR
********StaticVarGet( "svInterval" + s1 ) != Interval() OR
********StaticVarGet( "svMinbars" + s1 ) != minbars OR
********StaticVarGet( "svExtend" + s1 ) != extend OR
********StaticVarGetText( "svSymbol" + s1 ) != Name() OR
********NewBarJustArrived() OR
********trig )
{
****StaticVarSet( "DoEntirecalculation" + s1, 1 );
****//Say( " Do Calculation " );
}
*
StaticVarSet( "svOrder" + s1, order );
StaticVarSet( "svClevel" + s1, clevel );
StaticVarSet( "svInterval" + s1, Interval() );
StaticVarSet( "svMinbars" + s1, minbars );
StaticVarSet( "svExtend" + s1, extend );
StaticVarSetText( "svSymbol" + s1, Name() );
*
function CalculateCoefficients( aa, bb )
{
****n = MxGetSize( aa, 0 );
****ll = uu = Matrix( n, n, 0 );
****xx = yy = 0;
*
****for( j = 0; j < n; j++ )
****{
********for( i = 0; i < n; i++ )
********{
************if( i <= j )
************{
****************uu[i][j] = aa[i][j];
*
****************for( k = 0; k <= i - 1; k++ )
********************uu[i][j] -= ll[i][k] * uu[k][j];
*
****************if( i == j )
********************ll[i][j] = 1;
****************else
********************ll[i][j] = 0;
************}
************else
************{
****************ll[i][j] = aa[i][j];
*
****************for( k = 0; k <= j - 1; k++ )
********************ll[i][j] -= ll[i][k] * uu[k][j];
*
****************ll[i][j] /= uu[j][j];
****************uu[i][j] = 0;
************}
********}
****}
*
****for( i = 0; i < n; i++ )
****{
********yy[i] = bb[i];
*
********for( j = 0; j < i; j++ )
********{
************yy[i] -= ll[i][j] * yy[j];
********}
****}
*
****for( i = n - 1; i >= 0; i-- )
****{
********xx[i] = yy[i];
*
********for( j = i + 1; j < n; j++ )
********{
************xx[i] -= uu[i][j] * xx[j];
********}
*
********xx[i] /= uu[i][i];
****}
*
****return xx;
}
*
function CalculateFit( eb, bars )
{
****global reg;
****global x1a;
****global z1a;
****global regext;
****global regextx1a;
****global regextz1a;
*
****reg = x1a = z1a = Null;
****regext = regextx1a = regextz1a = Null;
*
****lb = eb;
****fb = eb - bars;
****nb = lb - fb;
*
****if( eb > bars )
****{
********aa = Matrix( order + 1, order + 1, 0 );
********bb = 0;
*
********// fill matrix A
********for( i = 0; i <= order; i++ )
********{
************for( j = 0; j <= order; j++ )
************{
****************for( k = fb; k <= lb; k++ )
****************{
********************vv = ( k - ( lb + fb ) / 2 );
********************aa[i][j] = aa[i][j] + ( vv ^ ( i + j ) );
****************}
************}
********}
*
********// fill matrix B
********for( i = 0; i <= order; i++ )
********{
************for( j = fb; j <= lb; j++ )
************{
****************vv = ( j - ( lb + fb ) / 2 );
****************bb[i] = bb[i] + prc[j] * ( vv ^ i );
************}
********}
*
********// calculate coefficients
********xx = CalculateCoefficients( aa, bb );
*
********// store the fit in reg
********for( i = fb; i <= lb; i++ )
********{
************reg[i] = xx[0];
*
************for( j = 1; j <= order; j++ )
************{
****************vv = ( i - ( lb + fb ) / 2 );
****************reg[i] = reg[i] + xx[j] * vv ^ j;
************}
********}
*
********// extended fit (only when channel is active at last bar)
********if( lb == BarCount - 1 )
********{
************for( i = lb + 1; i <= lb + extend; i++ )
************{
****************regext[i - extend] = xx[0];
*
****************for( j = 1; j <= order; j++ )
****************{
********************vv = ( i - ( lb + fb ) / 2 );
********************regext[i - extend] = regext[i - extend] + xx[j] * vv ^ j;
****************}
************}
********}
*
********// calculate standard deviation
********sdp = 0;
*
********for( i = fb; i <= lb; i++ )
********{
************sdp = sdp + ( prc[i] - reg[i] ) ^ 2;
********}
*
********sd = sqrt( sdp / ( bars - 2 ) ); // devide by ( bars - 2 ) corresponding to StdErr function
*
********x1a = reg + sd * clevel;
********z1a = reg - sd * clevel;
********regextx1a = regext + sd * clevel;
********regextz1a = regext - sd * clevel;
****}
}
*
if( StaticVarGet( "DoEntirecalculation" + s1 ) == 1 )
{
****regFinal = x1aFinal = z1aFinal = 0;
****regPerm = x1aPerm = z1aPerm = 0;
****buyPerm = sellPerm = 0;
*
****sb = fvb;
*
****for( i = fvb; i <= lvb; i++ )
****{
********eb = i;
********bars = eb - sb;
*
********if( bars > minbars )
********{
************calculateFit( eb, bars );
************regFinal = IIf( !IsEmpty( reg ), reg, regFinal );
************x1aFinal = IIf( !IsEmpty( x1a ), x1a, x1aFinal );
************z1aFinal = IIf( !IsEmpty( z1a ), z1a, z1aFinal );
*
************if( C[ i ] < z1aFinal [ i ] AND z1aFinal [ i ] > z1aFinal [ i - 1 ] )
************{
****************sellPerm[ eb ] = 1;
****************i = i + 2;
****************sb = i;
************}
************else
****************if( C[ i ] > x1aFinal [ i ] AND x1aFinal [ i ] < x1aFinal [ i - 1 ] )
****************{
********************buyPerm[ eb ] = 1;
********************i = i + 2;
********************sb = i;
****************}
*
************regPerm[ eb ] = reg[ eb ];
************x1aPerm[ eb ] = x1a[ eb ];
************z1aPerm[ eb ] = z1a[ eb ];
********}
****}
*
****regFinal = IIf( regFinal, regFinal, Null );
****x1aFinal = IIf( x1aFinal, x1aFinal, Null );
****z1aFinal = IIf( z1aFinal, z1aFinal, Null );
****regPerm = IIf( regPerm, regPerm, Null );
****x1aPerm = IIf( x1aPerm, x1aPerm, Null );
****z1aPerm = IIf( z1aPerm, z1aPerm, Null );
****buyPerm = IIf( buyPerm, buyPerm, Null );
****sellPerm = IIf( sellPerm, sellPerm, Null );
*
****StaticVarSet( "regFinal" + s1, regFinal );
****StaticVarSet( "x1aFinal" + s1, x1aFinal );
****StaticVarSet( "z1aFinal" + s1, z1aFinal );
****StaticVarSet( "regext" + s1, regext );
****StaticVarSet( "regextx1a" + s1, regextx1a );
****StaticVarSet( "regextz1a" + s1, regextz1a );
****StaticVarSet( "regPerm" + s1, regPerm );
****StaticVarSet( "x1aPerm" + s1, x1aPerm );
****StaticVarSet( "z1aPerm" + s1, z1aPerm );
****StaticVarSet( "buyPerm" + s1, buyPerm );
****StaticVarSet( "sellPerm" + s1, sellPerm );
}
*
*
SetChartOptions( 0, chartShowDates );
SetChartBkColor( colorBlack );
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey ) ) );
Plot( C, "", IIf( C > O, ColorRGB( 0, 255, 0 ), IIf( C <= O, ColorRGB( 255, 0, 0 ), colorLightGrey ) ), 64, Null, Null, 0, 1, 1 );
*
Plot( iif( !IsEmpty( StaticVarGet( "regPerm" + s1 ) ) , StaticVarGet( "regFinal" + s1 ), Null ), "", colorBlue, styleLine | styleNoLabel, Null, Null, 0, 1, 2 );
Plot( StaticVarGet( "regFinal" + s1 ), "", colorBlue, styleDashed, Null, Null, 0, 1, 1 );
Plot( iif( !IsEmpty( StaticVarGet( "regPerm" + s1 ) ) , StaticVarGet( "x1aFinal" + s1 ), Null ), "", colorred, styleLine | styleNoLabel, Null, Null, 0, 1, 2 );
Plot( StaticVarGet( "x1aFinal" + s1 ), "", colorred, styleDashed, Null, Null, 0, 1, 1 );
Plot( iif( !IsEmpty( StaticVarGet( "regPerm" + s1 ) ) , StaticVarGet( "z1aFinal" + s1 ), Null ), "", colorred, styleLine | styleNoLabel, Null, Null, 0, 1, 2 );
Plot( StaticVarGet( "z1aFinal" + s1 ), "", colorred, styleDashed, Null, Null, 0, 1, 1 );
Plot( StaticVarGet( "regext" + s1 ), "", colorlightgrey, styleDashed | styleNoLabel | styleNoRescale, Null, Null, extend, 0, 1 );
Plot( StaticVarGet( "regextx1a" + s1 ), "", colorlightgrey, styleDashed | styleNoLabel | styleNoRescale, Null, Null, extend, 0, 1 );
Plot( StaticVarGet( "regextz1a" + s1 ), "", colorlightgrey, styleDashed | styleNoLabel | styleNoRescale | styleClipMinMax, Null, Null, extend, 0, 1 );
*
hh = StaticVarGet( "x1aFinal" + s1 );
ll = StaticVarGet( "z1aFinal" + s1 );
PlotOHLC( ll, ll, hh, hh, "", ColorRGB( 10, 10, 10 ), styleCloud | styleNoLabel | styleNoRescale, Null, Null, 0, -1, 1 );
*
if( showTrack )
{
****Plot( StaticVarGet( "regPerm" + s1 ), "", colorLightBlue, styleDashed | styleNoLabel | styleNoRescale, Null, Null, 0, 1, 1 );
****Plot( StaticVarGet( "x1aPerm" + s1 ), "", colorOrange, styleDashed | styleNoLabel | styleNoRescale, Null, Null, 0, 1, 1 );
****Plot( StaticVarGet( "z1aPerm" + s1 ), "", colorOrange, styleDashed | styleNoLabel | styleNoRescale, Null, Null, 0, 1, 1 );
}
*
if( showSignals )
{
****PlotShapes( IIf( StaticVarGet( "buyPerm" + s1 ), shapeUpArrow, shapeNone ), colorDarkGreen, 0, L, -15 );
****PlotShapes( IIf( StaticVarGet( "buyPerm" + s1 ), shapeSmallCircle, shapeNone ), colorWhite, 0, C, 0 );
****PlotShapes( IIf( StaticVarGet( "sellPerm" + s1 ), shapeDownArrow, shapeNone ), colorRed, 0, H, -15 );
****PlotShapes( IIf( StaticVarGet( "sellPerm" + s1 ), shapeSmallCircle, shapeNone ), colorWhite, 0, C, 0 );
}
*
SecsToGo = Status( "lastbartimeleft" );
nm = StrMid( Name(), 0, StrLen( Name() ) );
Title = nm +
********" | " + Now( 2 ) +
********" | " + EncodeColor( ColorYellow ) + NumToStr( SecsToGo, 1.0, False ) + EncodeColor( colorWhite ) +
********" | " + NumToStr( order, 1.0, False ) + " | ";
i'm not talking about afl, i got it on internet while searching for muli dimensional afl ..

Code:
[COLOR="DarkRed"]function CalculateCoefficients( aa, bb )
{
    n = MxGetSize( aa, 0 );
    ll = uu = Matrix( n, n, 0 );
    xx = yy = 0;

    for( j = 0; j < n; j++ )
    {
        for( i = 0; i < n; i++ )
        {
            if( i <= j )
            {
                uu[i][j] = aa[i][j];

                for( k = 0; k <= i - 1; k++ )
                    uu[i][j] -= ll[i][k] * uu[k][j];

                if( i == j )
                    ll[i][j] = 1;
                else
                    ll[i][j] = 0;
            }
            else
            {
                ll[i][j] = aa[i][j];

                for( k = 0; k <= j - 1; k++ )
                    ll[i][j] -= ll[i][k] * uu[k][j];

                ll[i][j] /= uu[j][j];
                uu[i][j] = 0;
            }
        }
    }

    for( i = 0; i < n; i++ )
    {
        yy[i] = bb[i];

        for( j = 0; j < i; j++ )
        {
            yy[i] -= ll[i][j] * yy[j];
        }
    }

    for( i = n - 1; i >= 0; i-- )
    {
        xx[i] = yy[i];

        for( j = i + 1; j < n; j++ )
        {
            xx[i] -= uu[i][j] * xx[j];
        }

        xx[i] /= uu[i][i];
    }

    return xx;
}[/COLOR]
i have yet to see afl which has [][] with varset and varget..
matrix i have only saw one afl that has [][] ..

Simply means not lot of afl exist like that.. if you see reference for
matrix, there's [row][col]

we use price, volume, time .. that's it.. use these price,volume,time
instead of row col, it's confusing ..
 
Last edited: