No afl like this before? Is it possible to make it in other platforms

#1

http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-420.html#post1156355
I've a thread on link.

Is any system is built like this in other platform?
I can not find it any afl i an see for candlestick.


My question:(copying here)
Code:
I watch multiple timeframe 60 minute chart, 30 minute chart and 15 minute chart.
Do you know any afl that can give 60 minute candlestick signal on 30 minute candlestick ?
P.S. I use candlestick chart.
Example: 60 minute chart is green , it prints 60 minute green candle signal on 30 minute chart,I need to write arrow here
Is any afl as this?
(60 minute chart. 
Candle is green , my meaning bullish.
When 60 minute has bullish candlestick, it show arrow on 30 minute chart .)

regards

P.S. If i can't find system in one platform and want to know about it ,is it built in other system?
Is it right place to post in this section? it's not built before ,i think it's advance and i'm asking for other platform also.
This thread eligible in this section? i want to know about other platform also, is it built in other platform?
 
Last edited:
#2
Code:
 _SECTION_BEGIN("HOURLY CHART");
RequestTimedRefresh( 1 );
GraphXSpace=5;

TFMinLong = Param("Long Timeframe (Minutes)", 60, 1, 1500, 1);
BYSL=Param("BYSL",2,0.1,10,0.1);

TFSec = in1Minute * TFMinLong;
TimeFrameSet(TFSec);
TFOpen = Open;
TFHigh = High;
TFLow = Low;
TFClose = Close;
TFBarIndex = BarIndex();
TFLastBarIndex = LastValue(BarIndex());
TimeFrameRestore();

TFOpen = TimeFrameExpand(TFOpen, TFSec, expandFirst);
TFHigh = TimeFrameExpand(TFHigh, TFSec, expandFirst);
TFLow = TimeFrameExpand(TFLow, TFSec, expandFirst);
TFClose = TimeFrameExpand(TFClose, TFSec, expandFirst);
TFBarIndex = TimeFrameExpand(TFBarIndex, TFSec, expandLast + 1);
TFLastBarIndex = TimeFrameExpand(TFLastBarIndex, TFSec, expandLast + 1);

J = TFClose;

OP1 = Ref(TFOpen+BYSL,-1);

OP2 = Ref(TFOpen-BYSL,-1);
Plot(Op1, "",colorGreen,styleStaircase|styleNoLabel  );
Plot(Op2, "",colorRed,styleStaircase|styleNoLabel);

Buy_Valid = TFClose>OP1;
Sell_Valid = OP2>TFClose;
Candlecol=IIf(BarsSince(Buy_Valid)<BarsSince(Sell_Valid) AND BarsSince(Buy_Valid)!=0,5,
IIf(BarsSince(Buy_Valid)>BarsSince(Sell_Valid) AND BarsSince(Sell_Valid)!=0,4,1));
cc1=IIf(Buy_Valid,colorLime,IIf(Sell_Valid,colorRed,Candlecol));
SetBarFillColor(Cc1);

cc1=IIf(Buy_Valid,colorLime,IIf(Sell_Valid,colorRed,Candlecol));
PlotOHLC( TFOpen, TFHigh, TFLow, TFClose,  Name(), Cc1, styleCandle );
//PlotOHLC( TFOpen, TFOpen, TFClose, TFClose,  Name(), Cc1, styleCandle );

_SECTION_END();

_SECTION_BEGIN("PreDHL TdayHL");
x=LastVisibleValue(DateNum());
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
Cond=BarsSince(DateNum()<x);
y=Ref(DateNum(),-Cond);
Cond1=BarsSince(DateNum()<LastValue(y));
z=Cond1-Cond;
Hi0=HHV(H,Cond);
Hi0bar=HHVBars(H,Cond);

x20=BarCount-LastValue(Cond);
x21=BarCount-1;
y20=LastVisibleValue(Hi0);
y21=y20;
Line2 = LineArray( x20, y20, x21, y21, 1 );
Plot( Line2, "day high line", colorOrange,styleThick|styleNoTitle|styleNoLabel);
PlotText(" DH " , LastValue(BarIndex())-(numbars/Hts), Y20, colorOrange);

Li0=LLV(L,Cond);
Li0bar=LLVBars(L,Cond);

x30=BarCount-LastValue(Cond);
x31=BarCount-1;
y30=LastVisibleValue(Li0);
y31=y30;
Line3 = LineArray( x30, y30, x31, y31, 1 );
Plot( Line3, "day low line", colorTurquoise,styleThick|styleNoTitle|styleNoLabel );
PlotText(" DL " , LastValue(BarIndex())-(numbars/Hts), Y30, colorTurquoise);

Hi=Ref(HHV(H,z),-Cond);
Hibar=Ref(HHVBars(H,z),-Cond)+Cond;
x0=BarCount-1-LastValue(Hibar);
x1=BarCount-1;
y0=LastValue(Hi);
y1=y0;
Line = LineArray( x0, y0, x1, y1, 1 );
Plot( Line, "high line",  colorGreen,styleThick|styleNoTitle|styleNoLabel );
PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), Y0, colorGreen);


Lo=Ref(LLV(L,z),-Cond);
Lobar=Ref(LLVBars(L,z),-Cond)+Cond;

x00=BarCount-1-LastValue(Lobar);
x01=BarCount-1;
y00=LastValue(Lo);
y01=y00;

Line11=LineArray(x00,y00,x01,y01,1);
Plot(Line11,"Low Line",colorBlue,styleThick|styleNoTitle|styleNoLabel);
PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), Y00, colorBlue);
_SECTION_END();

_SECTION_BEGIN("OPCL line");
FB   = DateNum() != Ref(DateNum(),-1);
FB1   = DateNum() != Ref(DateNum(),-1);
FB2   = DateNum() != Ref(DateNum(),-1);
FB3   = DateNum() != Ref(DateNum(),-1);
Bars = 1 + BarsSince(FB);

Op  =  ValueWhen(FB,O);
Hi  =  ValueWhen(FB2,H);
Lo  =  ValueWhen(FB3,L);
Cl  =  ValueWhen(FB1,C);

Plot(Op, "",colorRed,styleDashed|styleNoLabel);
//Plot(Hi, "",colorYellow,styleDashed|styleNoLabel);
//Plot(Lo, "",colorPink,styleDashed|styleNoLabel);
Plot(Cl, "",colorBrightGreen,styleDashed|styleNoLabel);

FB   = DateNum() != Ref(DateNum(),1);
Opc  =  ValueWhen(FB,C);
Plot(Opc, "",colorWhite,styleLine|styleNoLabel);
_SECTION_END();
 
#3
Code:
 _SECTION_BEGIN("HOURLY CHART");
RequestTimedRefresh( 1 );
GraphXSpace=5;

TFMinLong = Param("Long Timeframe (Minutes)", 60, 1, 1500, 1);
BYSL=Param("BYSL",2,0.1,10,0.1);

TFSec = in1Minute * TFMinLong;
TimeFrameSet(TFSec);
TFOpen = Open;
TFHigh = High;
TFLow = Low;
TFClose = Close;
TFBarIndex = BarIndex();
TFLastBarIndex = LastValue(BarIndex());
TimeFrameRestore();

TFOpen = TimeFrameExpand(TFOpen, TFSec, expandFirst);
TFHigh = TimeFrameExpand(TFHigh, TFSec, expandFirst);
TFLow = TimeFrameExpand(TFLow, TFSec, expandFirst);
TFClose = TimeFrameExpand(TFClose, TFSec, expandFirst);
TFBarIndex = TimeFrameExpand(TFBarIndex, TFSec, expandLast + 1);
TFLastBarIndex = TimeFrameExpand(TFLastBarIndex, TFSec, expandLast + 1);

J = TFClose;

OP1 = Ref(TFOpen+BYSL,-1);

OP2 = Ref(TFOpen-BYSL,-1);
Plot(Op1, "",colorGreen,styleStaircase|styleNoLabel  );
Plot(Op2, "",colorRed,styleStaircase|styleNoLabel);

Buy_Valid = TFClose>OP1;
Sell_Valid = OP2>TFClose;
Candlecol=IIf(BarsSince(Buy_Valid)<BarsSince(Sell_Valid) AND BarsSince(Buy_Valid)!=0,5,
IIf(BarsSince(Buy_Valid)>BarsSince(Sell_Valid) AND BarsSince(Sell_Valid)!=0,4,1));
cc1=IIf(Buy_Valid,colorLime,IIf(Sell_Valid,colorRed,Candlecol));
SetBarFillColor(Cc1);

cc1=IIf(Buy_Valid,colorLime,IIf(Sell_Valid,colorRed,Candlecol));
PlotOHLC( TFOpen, TFHigh, TFLow, TFClose,  Name(), Cc1, styleCandle );
//PlotOHLC( TFOpen, TFOpen, TFClose, TFClose,  Name(), Cc1, styleCandle );

_SECTION_END();

_SECTION_BEGIN("PreDHL TdayHL");
x=LastVisibleValue(DateNum());
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
Cond=BarsSince(DateNum()<x);
y=Ref(DateNum(),-Cond);
Cond1=BarsSince(DateNum()<LastValue(y));
z=Cond1-Cond;
Hi0=HHV(H,Cond);
Hi0bar=HHVBars(H,Cond);

x20=BarCount-LastValue(Cond);
x21=BarCount-1;
y20=LastVisibleValue(Hi0);
y21=y20;
Line2 = LineArray( x20, y20, x21, y21, 1 );
Plot( Line2, "day high line", colorOrange,styleThick|styleNoTitle|styleNoLabel);
PlotText(" DH " , LastValue(BarIndex())-(numbars/Hts), Y20, colorOrange);

Li0=LLV(L,Cond);
Li0bar=LLVBars(L,Cond);

x30=BarCount-LastValue(Cond);
x31=BarCount-1;
y30=LastVisibleValue(Li0);
y31=y30;
Line3 = LineArray( x30, y30, x31, y31, 1 );
Plot( Line3, "day low line", colorTurquoise,styleThick|styleNoTitle|styleNoLabel );
PlotText(" DL " , LastValue(BarIndex())-(numbars/Hts), Y30, colorTurquoise);

Hi=Ref(HHV(H,z),-Cond);
Hibar=Ref(HHVBars(H,z),-Cond)+Cond;
x0=BarCount-1-LastValue(Hibar);
x1=BarCount-1;
y0=LastValue(Hi);
y1=y0;
Line = LineArray( x0, y0, x1, y1, 1 );
Plot( Line, "high line",  colorGreen,styleThick|styleNoTitle|styleNoLabel );
PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), Y0, colorGreen);


Lo=Ref(LLV(L,z),-Cond);
Lobar=Ref(LLVBars(L,z),-Cond)+Cond;

x00=BarCount-1-LastValue(Lobar);
x01=BarCount-1;
y00=LastValue(Lo);
y01=y00;

Line11=LineArray(x00,y00,x01,y01,1);
Plot(Line11,"Low Line",colorBlue,styleThick|styleNoTitle|styleNoLabel);
PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), Y00, colorBlue);
_SECTION_END();

_SECTION_BEGIN("OPCL line");
FB   = DateNum() != Ref(DateNum(),-1);
FB1   = DateNum() != Ref(DateNum(),-1);
FB2   = DateNum() != Ref(DateNum(),-1);
FB3   = DateNum() != Ref(DateNum(),-1);
Bars = 1 + BarsSince(FB);

Op  =  ValueWhen(FB,O);
Hi  =  ValueWhen(FB2,H);
Lo  =  ValueWhen(FB3,L);
Cl  =  ValueWhen(FB1,C);

Plot(Op, "",colorRed,styleDashed|styleNoLabel);
//Plot(Hi, "",colorYellow,styleDashed|styleNoLabel);
//Plot(Lo, "",colorPink,styleDashed|styleNoLabel);
Plot(Cl, "",colorBrightGreen,styleDashed|styleNoLabel);

FB   = DateNum() != Ref(DateNum(),1);
Opc  =  ValueWhen(FB,C);
Plot(Opc, "",colorWhite,styleLine|styleNoLabel);
_SECTION_END();

http://i.imgur.com/4EMTuKK.png
Hi
Where is arrow in chart?

example: 60 minute chart is bullish. C1>O1;
30 minute it show arrow only when 60 minute is bullish.

regards
 
Last edited:

cheap

Active Member
#7
In Ninjatrader, there IS an indicator , i dont know name.
In amibroker, there is none or ?

Do you know other platform, which has same indicator?


regards

PS.S This thread section allows to ask other platform
Code:
_SECTION_BEGIN("anything");

     [B] TimeframeSet( in30Minute);

    
         Bar =  C>O;
      TimeframeRestore();  
 
      TimeframeSet( in60Minute);
   
        Bar = C>O;
      TimeframeRestore();  



Bar30= TimeFrameExpand( Bar, in30Minute,expandFirst);  
Bar60= TimeFrameExpand( Bar, in60Minute,expandFirst);  

PlotShapes( IIF( Bar30==1 AND Bar60==1, shapeUpArrow , shapeNone ), colorAqua ); 

Plot( C, "Price", colorDefault, styleCandle ); // Just to show on pane
_SECTION_END();
[/B]

This is not right code, This code prints wrong arrow.
You gonna get problem printing on correct candle.

but it gonna be something like that ..
your problem is bit basic of what I've asked, I want to extract value from loop .
btw you told you use three timeframes in thread .

TimeFrameGetPrice (Time Frame functions) - retrieve O, H, L, C, V values from other time frame (AFL 2.5)
I guess you need to use this function too


Do you know if such exploration is possible in another platform.
I heard about lot of folks make scripts in python ..

As far as i know, ninjatrader community way too big, So you might get help there sooner, but I doubt, don't know Scanning is much powerful as it has.
If you know any other platform ,that can do such stuff, either other platform or custom platform gui .. anything ..
Let us know.
 
Last edited:

cheap

Active Member
#8
Code:
SetChartOptions(0,chartShowArrows|chartShowDates);

_SECTION_BEGIN("anything");

     [B] TimeframeSet( in30Minute);

    
         Bar =  C>O;
      TimeframeRestore();  
 
      TimeframeSet( in60Minute);
   
        Bar = C>O;
      TimeframeRestore();  



Bar30= TimeFrameExpand( Bar, in30Minute,expandFirst);  
Bar60= TimeFrameExpand( Bar, in60Minute,expandFirst);  

PlotShapes( IIF( Bar30==1 AND Bar60==1, shapeUpArrow , shapeNone ), colorAqua ); 

Plot( C, "Price", colorDefault, styleCandle ); // Just to show on pane
_SECTION_END();
[/B]

This is not right code, This code prints wrong arrow.
You gonna get problem printing on correct candle.

but it gonna be something like that ..
your problem is bit basic of what I've asked, I want to extract value from loop .
btw you told you use three timeframes in thread .

TimeFrameGetPrice (Time Frame functions) - retrieve O, H, L, C, V values from other time frame (AFL 2.5)
I guess you need to use this function too


Do you know if such exploration is possible in another platform.
I heard about lot of folks make scripts in python ..

As far as i know, ninjatrader community way too big, So you might get help there sooner, but I doubt, don't know Scanning is much powerful as it has.
If you know any other platform ,that can do such stuff, either other platform or custom platform gui .. anything ..
Let us know.
HI, my problem is more than that .. i'm extracting from loop values.
I couldn't able to find a single afl worked tht way..

btw if you want to use only for two timeframe, It is already been done in ninja, I know a guy , he did it in NinjaTrader , his name start from dev.... I'm sure he's also in form .
If you want to solve it early, you can ask him, he might tell you ..
If you also looking like mine, then just wait ! I suggest don't wait ,if you not using more than two timeframes.
P.S. : I HAVE NO IDEA IF SUGGESTING NAME IS LEGAL OR ILLEGAL ON FORM. LET ME CONFIRM IT FIRST.I DIDN'T TOLD YOU NAME THOUGH


AS YOU ARE TRADER, YOUR DUTY IS DO TRADE RIGHT, AND NEED RIGHT TOOLS, SO I TOLD YOU ABOUT THAT ... REST ARE PROGRAMMER, WHO JUST MAKE SYSTEMS,THEIR LIVING NOT LIKE TRADER, WHO JUST DEPEND ON IT. SO IF YOU'RE FULL TIME ONE, KINDLY SOLVE IT AS SOON AS POSSIBLE. DON'T WAIT LIKE ME.
 
Last edited:

bunti_k23

Well-Known Member
#9
i modified it,but dont know why its repainting....

Code:
_SECTION_BEGIN("anything");

      TimeframeSet( in1Minute);

    
         Bar =  C>O;
         bar1 = C<O;
      TimeframeRestore();  
 
      TimeframeSet( inhourly);
   
        Bar = C>O;
        bar1 = C<O;
      TimeframeRestore();  



Bar30= TimeFrameExpand( Bar, in1Minute,expandFirst);  
Bar60= TimeFrameExpand( Bar, inhourly,expandFirst);  
Barr30= TimeFrameExpand( Bar1, in1Minute,expandFirst);  
Barr60= TimeFrameExpand( Bar1, inhourly,expandFirst);  

xe11 = bar30 AND bar60;
xe12 = barr30 AND barr60;

Buy = xe11;
Sell = xe12;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Buy[BarCount-1]=Null;
Sell[BarCount-1]=Null;

Cover=Buy;
Short=Sell;




shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorWhite, colorWhite ),0, IIf( Buy, Low, High ) );




Plot( C, "Price", colorDefault, styleCandle ); // Just to show on pane
_SECTION_END();
 

LOVEENAJYOTHI

Well-Known Member
#10
i modified it,but dont know why its repainting....

Code:
_SECTION_BEGIN("anything");

      TimeframeSet( in1Minute);

    
         Bar =  C>O;
         bar1 = C<O;
      TimeframeRestore();  
 
      TimeframeSet( inhourly);
   
        Bar = C>O;
        bar1 = C<O;
      TimeframeRestore();  



Bar30= TimeFrameExpand( Bar, in1Minute,[B][COLOR="Red"]expandFirst[/COLOR][/B]);  
Bar60= TimeFrameExpand( Bar, inhourly,[B][COLOR="red"]expandFirst[/COLOR][/B]);  
Barr30= TimeFrameExpand( Bar1, in1Minute,[B][COLOR="red"]expandFirst[/COLOR][/B]);  
Barr60= TimeFrameExpand( Bar1, inhourly,[B][COLOR="red"]expandFirst[/COLOR][/B]);  

xe11 = bar30 AND bar60;
xe12 = barr30 AND barr60;

Buy = xe11;
Sell = xe12;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Buy[BarCount-1]=Null;
Sell[BarCount-1]=Null;

Cover=Buy;
Short=Sell;




shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorWhite, colorWhite ),0, IIf( Buy, Low, High ) );




Plot( C, "Price", colorDefault, styleCandle ); // Just to show on pane
_SECTION_END();

Culprits caught Red handed.

Reason:
For the sake of ease, lets assume u wanna compress daily bars to weekly bars--->And u command "ExpandFirst" ---> this will force ur Amibroker to give u the price of next Friday on Monday itself---and will keep Repainting as the bars progress----->Like this is what is happening in ur above code.

Solution:
1.Use ExpandLast

2.Goto--->Tools---->Preferences--->IntraDay----->Select START time of Interval (recommended).
 

Similar threads