interday trading system with target and stop by vijay

#1
the amibroker code is below:
SetChartOptions( 0, chartShowArrows | chartShowDates );

H1 = SelectedValue( TimeFrameGetPrice( "H", inDaily, -1 ) );
L1 = SelectedValue( TimeFrameGetPrice( "L", inDaily, -1 ) );
C1 = SelectedValue( TimeFrameGetPrice( "C", inDaily, -1 ) );
H2 = SelectedValue( TimeFrameGetPrice( "H", inDaily, 0 ) );
L2 = SelectedValue( TimeFrameGetPrice( "L", inDaily, 0 ) );
O1 = SelectedValue( TimeFrameGetPrice( "open", inDaily, 0 ) );
D1 = ( H1 - L1 );
D2 = ( H2 - L2 );
F1 = D1 * 0.433;



F4 = 0;

if ( D2 <= F1 )
F4 = F1;
else
if ( D2 <= F2 )
F4 = F2;
else
F4 = F3;



S_P = ( O1 - F4 );

B_P = ( O1 + F4 );

BP = ( L2 + F4 );

BPTGT = ( BP + ( BP * .0065 ) );

BPSTPLS = ( BP - ( BP * .0085 ) );

SP = ( H2 - F4 );

SPTGT = ( SP - ( SP * .0065 ) );

SPSTPLS = ( SP + ( SP * .0085 ) );


p = ( H1 + L1 + C1 ) / 3;

//CONDITION

STRONG = ( C > p );

WEAK = ( C < P );

//Plot

Plot ( p , "PIVOT", 25, 4 );PlotText( "PIVOT" , BarCount-25, p+0, 25 );


Plot ( r1, "PRE_LOW", 29, 4 );PlotText( "PreDay LOW" , BarCount-0, r1+0, 29 );

Plot ( s1, "PRE_HIGH", 29, 4 );PlotText( "PreDay HIGH" , BarCount-0, s1+0, 29 );

Plot ( s2, "DAY_HIGH", 42, 4 );PlotText( "Day HIGH" , BarCount-0, s2+0, 42 );

Plot ( r2, "DAY_LOW", 42, 4 );PlotText( "Day LOW" , BarCount-0, r2+0, 42 );


Plot ( BP, "BUY @", 35, 4 );PlotText( "Buy-Long" , BarCount-0, BP+0, 35 );


Plot ( BPTGT, "BUY & SELL @", 40, 4 );PlotText( "Sell-LongSell" , BarCount-25, BPTGT+0, 40 );


Plot ( BPSTPLS, "STPLS-FOR-BUY @", 32, 4 );PlotText( "STP-LS LongSell" , BarCount-25, BPSTPLS+0, 32 );


Plot ( SP, "SELL @", 35, 4 );PlotText( "Sell-Short" , BarCount-25, SP+0, 35 );


Plot ( SPTGT, "SEL & BUY @", 40, 4 );PlotText( "Buy-ShortCover" , BarCount-25, SPTGT+0, 40 );


Plot ( SPSTPLS, "STPLS-FOR-SELL @", 32, 4 );PlotText( "STP-LS ShortCover" , BarCount-25, SPSTPLS+0, 32 );





GfxSetBkColor( colorRed );

GfxSetTextColor( 41 );

GfxSelectFont( "TOHMA", 9, 700, False );



GfxSetBkColor( colorLightGrey );

GfxSetTextColor( 16 );



GfxTextOut("* "+ ( WriteVal( H1 ) + "--" + WriteVal( L1 ) + "=PreDay=" + WriteVal( D1 ) ), 32, 100 );

GfxTextOut("* "+ ( WriteVal( H2 ) + "--" + WriteVal( L2 ) + "=ToDay=" + WriteVal( D2 ) ), 32, 115 );

GfxTextOut( "F1=" + ( WriteVal( F1 ) ), 32, 130 );

GfxTextOut( "F2=" + ( WriteVal( F2 ) ), 32, 145 );

GfxTextOut( "F3=" + ( WriteVal( F3 ) ), 32, 160 );


GfxTextOut( "Selected FC==" + ( WriteVal( F4 ) ), 32, 175 );

GfxTextOut( ( "-P-TGT 0.65 and STP-LS 1.0(Inc-Bkrg)-" ), 32, 190 );



















AlertIf( Buy, "SMAIL", "BUY @ "+BuyPrice+FullName(), 1 );

AlertIf( Sell, "SMAIL", "SELL @ "+SellPrice+FullName(), 2 );



_SECTION_END();





_SECTION_BEGIN("GANN");

A=Ref(O,0);
B=Ref(H,0);
D=Ref(L,0);
E=Ref(C,0);
F=ATR(2);
G=((100*F)/E);
Pivot=((A+B+D+E)/4);
BUYrange=B-D;
Sellrange=B-D;
BUYABOVE=C+((BUYrange*1/8));
TGT1=C+((BUYrange*1/4));

TGT2 =C+((BUYrange*1/3));
TGT3=C+((BUYrange*3/8));
TGT4=C+((BUYrange*1/2));
TGT5=C+((BUYrange*5/8));
TGT6=C+((BUYrange*2/3));
TGT7=C+((BUYrange*3/4));
Sellbelow=C-(BUYrange*1/8);
L1=C-(BUYrange*1/4);

L2=C-(BUYrange*1/3);
L3=C-(BUYrange*3/8);
L4=C-(BUYrange*1/2);
L5=C-(BUYrange*5/8);
L6=C-(BUYrange*2/3);
L7=C-(BUYrange*3/4);
Filter=1;



AddColumn(TGT1,"Long@",1.2,colorBlack,colorGreen,-1);
AddColumn(Sellbelow,"SL",1.2,colorBlack,colorYellow,-1);

AddColumn(TGT4,"TGT1",1.2,colorBlack,colorPink,-1);
AddColumn(TGT7,"TGT2",1.2,colorBlack,colorPink,-1);

AddColumn(L1,"Short@",1.2,colorBlack,colorRed,-1);
AddColumn(BuyABOVE,"SL",1.2,colorBlack,colorYellow,-1);
AddColumn(L4,"TGT1",1.2,colorBlack,colorPink,-1);
AddColumn(L7,"TGT2",1.2,colorBlack,colorPink,-1);
;


_SECTION_END();



_SECTION_BEGIN("exploration 1");

Filter = 0;
DTL=140; // DTL = Define Long
DTM=60; // DTM = Define Medium
DTS=8; // DTS = Define Short

//////////////////////////////////////////////////////////////

TL=LinRegSlope(MA(C, DTL),2); // TL = Long
TM=LinRegSlope(MA(C, DTM),2); // TM = Medium
TS=LinRegSlope(MA(C, DTS),2); // TS = Short

TLL=(LinRegSlope(MA(C, DTL),2) > 0,True, False);
TMM=(LinRegSlope(MA(C, DTM),2) > 0,True, False);
TSS=(LinRegSlope(MA(C, DTS),2) > 0,True, False);


WriteIf(TL>0 AND TL<0.3,"+",
WriteIf(TL>=0.3 AND TL<0.6 ,"+ +",
WriteIf(TL>=0.6,"+ + +",
WriteIf(TL<0 AND TL>-0.3,"-",
WriteIf(TL<=-0.3 AND TL>-0.6 ,"- -",
WriteIf(TL<=-0.6,"- - -",""))))));

TMMM=
WriteIf(TM>0 AND TM<0.3,"+",
WriteIf(TM>=0.3 AND TM<0.6 ,"+ +",
WriteIf(TM>=0.6,"+ + +",
WriteIf(TM<0 AND TM>-0.3,"-",
WriteIf(TM<=-0.3 AND TM>-0.6 ,"- -",
WriteIf(TM<=-0.6,"- - -",""))))));

TSSS=
WriteIf(TS>0 AND TS<0.3,"+",
WriteIf(TS>=0.3 AND TS<0.6 ,"+ +",
WriteIf(TS>=0.6,"+ + +",
WriteIf(TS<0 AND TS>-0.3,"-",
WriteIf(TS<=-0.3 AND TS>-0.6 ,"- -",
WriteIf(TS<=-0.6,"- - -",""))))));

//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////
message=
WriteIf(TL>=0.3 AND TM>=0.3 AND
TS>=0.3, "Strong Up ",
WriteIf(TL<=-0.3 AND TM<=-0.3 AND
TS<=-0.3, "Strong Down ",
WriteIf(TLL==True AND TMM==True AND
TSS==True,"Up ",
WriteIf(TLL==False AND TMM==False AND
TSS==False,"Down ", "No "))));


AddTextColumn( message, "TREND ", 1 ,
colorDefault,IIf(TLL==True AND TMM==True AND
TSS==True, colorGreen,
IIf(TLL==False AND TMM==False AND
TSS==False, colorRed, colorDefault )),-1 );

//////////////////////////////////////////////////////////////


_SECTION_END();
 

Similar threads