Help Needed In AMibroker Coding

casoni

Well-Known Member
#4
HI casoni thanks for the reply ,pls post the code

SetChartOptions(0,chartShowDates);
BaseMkt=".nsei"; // <-------------- Index Symbol ----
base_p = Foreign(BaseMkt, "C",TRUE);
mabase=MA(base_p,15);
Plot(base_p,"",4,1);
Plot(MABASE,"",3,1);
Buyok = Cross(base_p,mabase);
sellok = Cross(mabase,base_P);
PlotShapes(Buyok*shapeUparrow+Sellok*shapeDownarrow, IIf(Buyok,colorgreen,colorred),0,IIf(Buyok,mabase-3,mabase+3)) ;


xx=BarIndex();x=xx;Lx=LastValue(x);
fvb=Status("firstvisiblebarindex");
lvb=Min(Lx,Status("lastvisiblebarindex"));
dt=DateTime() ;//
bdt=ValueWhen(buyok,dt);
sdt=ValueWhen(sellok,dt);
for(i=fvb;i<lvb;i++)
{
if(buyok) PlotTextSetFont(""+DateTimeToStr( bdt [ i ] ),"Ariel",8,i,mabase,colorGreen,colordefault,-15);
if(sellok) PlotTextSetFont(""+DateTimeToStr( sdt [ i ] ),"Ariel",8,i,mabase,colorred,colordefault,15);

}

watchlistCheck = InWatchList( 1 ) ;//OR InWatchList( 2 );
Buy = watchlistCheck AND Buyok ;
sell = watchlistCheck AND sellok;
BuyPrice=SellPrice=Close;
Filter=1; // t
AddColumn(IIf(Buy,BuyPrice,Null),"Buy",1.2,2,colorGreen);
AddColumn(IIf(sell,sellPrice,Null),"Sell",1.2,2,colorred);
 
#7
My Base trading Chart is Nifty
and the symbol name is : Nifty_F

My Watchlist is dlf,cairn,ongc,reliance

How to apply the avobe afl for the below trading system


res=HHV(H,20);
sup=LLV(L,20);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);


Buy=Cross(C,Ref(res,-1));
Sell=Cross(Ref(sup,-1),C);
short=sell;
cover= buy;
 

mastermind007

Well-Known Member
#8
SetChartOptions(0,chartShowDates);
BaseMkt=".nsei"; // <-------------- Index Symbol ----
base_p = Foreign(BaseMkt, "C",TRUE);
mabase=MA(base_p,15);
Plot(base_p,"",4,1);
Plot(MABASE,"",3,1);
Buyok = Cross(base_p,mabase);
sellok = Cross(mabase,base_P);
PlotShapes(Buyok*shapeUparrow+Sellok*shapeDownarrow, IIf(Buyok,colorgreen,colorred),0,IIf(Buyok,mabase-3,mabase+3)) ;


xx=BarIndex();x=xx;Lx=LastValue(x);
fvb=Status("firstvisiblebarindex");
lvb=Min(Lx,Status("lastvisiblebarindex"));
dt=DateTime() ;//
bdt=ValueWhen(buyok,dt);
sdt=ValueWhen(sellok,dt);
for(i=fvb;i<lvb;i++)
{
if(buyok) PlotTextSetFont(""+DateTimeToStr( bdt [ i ] ),"Ariel",8,i,mabase,colorGreen,colordefault,-15);
if(sellok) PlotTextSetFont(""+DateTimeToStr( sdt [ i ] ),"Ariel",8,i,mabase,colorred,colordefault,15);

}

watchlistCheck = InWatchList( 1 ) ;//OR InWatchList( 2 );
Buy = watchlistCheck AND Buyok ;
sell = watchlistCheck AND sellok;
BuyPrice=SellPrice=Close;
Filter=1; // t
AddColumn(IIf(Buy,BuyPrice,Null),"Buy",1.2,2,colorGreen);
AddColumn(IIf(sell,sellPrice,Null),"Sell",1.2,2,colorred);



Code:
SetForeign("<<<<NIFTY INDEX SYMBOL >>>>"); 
mabase=MA(Close,15);
Buy = Cross(Close,mabase);
RestorePriceArrays(); 
Filter = Buy;
AddColumn(IIf(Buy,BuyPrice,Null),"Buy",1.2,2,colorGreen);

Above code, when run in the Explorer (or scanner) should propagate a buy signal from foreign symbol into the main symbol...

if you run this scanner with all symbols in Scanner or Explorer's Filter, it will show trade in all symbols.

if you run this scanner with one symbol in Scanner or Explorer's Filter, it will show trade in that one scrip.
 
#9
My Base trading Chart is Nifty
and the symbol name is : Nifty_F

My Watchlist is dlf,cairn,ongc,reliance

How to apply the avobe afl for the below trading system


res=HHV(H,20);
sup=LLV(L,20);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);


Buy=Cross(C,Ref(res,-1));
Sell=Cross(Ref(sup,-1),C);
short=sell;
cover= buy;
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?