Simple Coding Help - No Promise.

amitrandive

Well-Known Member
HTML:
For Buy 

Price > 5 SMA
Stochastic(5,3,3) Bullish crossover
CCI>100

All above conditions to be satisfied for a buy.

For Sell 

Price <5 SMA
Stochastic (5,3,3)Bearish crossover
CCI<-100

All above conditions to be satisfied for a sell.
(Only change was CCI value rest all perfect)
Thanx you
Try this code,have added parameters so you can change them if you want.For exploration/scanning only.

Code:
//SMA
periods = Param("SMA period", 5, 2, 100, 1 ); 
myMA=MA(C,periods);
//Stochastics
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
myStochD=StochD( periods , Ksmooth, DSmooth );
myStochK=StochK( periods , Ksmooth);
// CCI
periods = Param("CCI period", 20, 2, 100, 1 ); 
myCCI = CCI( periods );
// signal conditions
BuyStoc = Cross(myStochK, myStochD );
SellStoc = Cross( myStochD, myStochK );
Buy = Cross(C,myMA) AND BuyStoc  AND myCCI >100;
Sell = Cross(myMA,C) AND SellStoc  AND myCCI <-100;
 
Buy =ExRem(Buy, Sell);    // this removes additional signals between the first buy up to the 
Sell = ExRem(Sell,Buy);
// explore variables
Filter = Buy OR Sell;
AddColumn(Close, "Close", 1.2);
AddColumn(Buy, "Buy", 1.0);
AddColumn(Sell, "Sell",1.0);
_SECTION_END();
 

amsin21

Well-Known Member
Dear friends,

I am looking for OBV on screen alert for multiple time frames :

Condition : when the volume is

positive = Buy
negative = Sell

Thanks
 
Hi friends,

Yesterday while updating nse eod data in amibroker , by mistake updated eod ascii using intraday format which i had setup for data downloader google intraday format.
Now in eod charts there are these unwanted extra quotes with upto 2000% change in price and only a large spike on last bar in chart !!!
I tried deleting session using edit> delete session
and quote editor > all symbols > shift select all scrips for 18-3-2015 but nothing useful.. check below screen shot...
How to delete these quotes ?



Please help in fixing this problem..
Thank you.
 

amsin21

Well-Known Member
Dear friends,

I am looking for OBV on screen alert for multiple time frames :

Condition : when the volume is

positive = Buy
negative = Sell

Thanks
Any expert help? :sos:
 

sr114

Well-Known Member
Hi friends,

Yesterday while updating nse eod data in amibroker , by mistake updated eod ascii using intraday format which i had setup for data downloader google intraday format.
Now in eod charts there are these unwanted extra quotes with upto 2000% change in price and only a large spike on last bar in chart !!!
I tried deleting session using edit> delete session
and quote editor > all symbols > shift select all scrips for 18-3-2015 but nothing useful.. check below screen shot...
How to delete these quotes ?



Please help in fixing this problem..
Thank you.
Use this to rectify the problem
http://wisestocktrader.com/indicators/4222-remove-data-between-the-dates

rgds
 
Last edited:
hello

i am attaching an afl which plots n/bars high and low on price

-- i request for the same thing on volume

by quantity



--- please note that the attached afl has param option need similar for the volume also

a "n" day high in volume shud be given diff coloring and and low shud be given diff color on top of the volume bar


rgds

sumit


PHP:
/* Done by    Rajandran R  */
/* Author of www.marketcalls.in  */
 
_SECTION_BEGIN("N Bar High/Low Dots");
 
SetBarsRequired(100000,0);
 
GraphXSpace = 15;
 
SetChartOptions(0,chartShowArrows|chartShowDates);
 
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
 
GfxSetBkMode(0);
 
GfxSetOverlayMode(1);
 
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
 
Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
 
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
 
nhigh = Param("N Bar High", 20, 1,100,1);
nlow =  Param("N Bar Low", 20, 1,100,1);
 
nhi = HHV(H,nhigh);
nlow = LLV(L,nlow);
 
hidot = IIf(nhi>Ref(nhi,-1),True,False);
lowdot = IIf(nlow<Ref(nlow,-1),True,False);
 
Plot(IIf(hidot,H,Null),"High Dots",colorCustom8,style = styleDots | styleThick | styleNoLine);
Plot(IIf(lowdot,L,Null),"Low Dots",colorWhite,style = styleDots | styleThick | styleNoLine);
 
_SECTION_END();
 
Last edited:
To delete quotes:
Besides what SR114 has suggested, you could also try Josh1 utility called, DeleteRT_Tics.exe, you can d/load
it from Josh1 signature on this forum.
Thank you. Downloaded rtd 1.25 and tried to delete ticks for 18-3-2015 which has corrupt data.
In delete tics , set date and time and selected all symbols and clicked
Start Delete. In a while it gives Complete.
Then both delete tics and amibroker close and amibroker gives some unexpected error handling error mg...
I think creating new database is next option.
Importing ascii is no trouble , but fixing database for splits etc is....

Lesson learnt : Always backup amibroker database regularly just in case ..

Thank you :)
 
Hi,

I have the below fractal based system. Request experts to please help in modifying the code as per the following conditions.

1. Buy should be above the fractal above fast/slow EMA and short should be
below the fractal below fast/slow EMA.
2. for Buy, trade should be closed on the break of previous fractal low.
3. Similarly for short, trade should be closed if the fractal high is broken.


=================================================
_SECTION_BEGIN("Price");
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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

SetChartBkColor(colorBlack);
SetPositionSize(1,spsShares);

_SECTION_BEGIN("JUNCTION");

Lpr = Param("Fast",3,3,50,1);
a1=EMA(H,LPR);
b1=EMA(L,LPR);

Hpr = Param("Slow",30,10,600,3);
a2=EMA(H,Hpr);
b2=EMA(L,Hpr);


dispFastEMA=ParamToggle("Display Fast EMA","No|Yes");
dispSlowEMA=ParamToggle("Display Slow EMA","No|Yes");

if (dispFastEMA == 1)
{
Plot(a1,"",colorLightBlue,1);
Plot(b1,"",colorPink,1);
}


if (dispSlowEMA == 1)
{
Plot(a2,"",colorBrightGreen,1);
Plot(b2,"",colorYellow,1);
}

GraphXSpace =5;
_SECTION_END();


_SECTION_BEGIN("BW Fractal");

/* UpFractal= ValueWhen( */
SellFractal= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));

/* DownFractal= ValueWhen( */
BuyFractal= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));


NewSellFractal=(Ref(SellFractal,2) > Ref(SellFractal,1) OR Ref(SellFractal,2) < Ref(SellFractal,1));
NewBuyFractal=(Ref(BuyFractal,2) > Ref(BuyFractal,1) OR Ref(BuyFractal,2) < Ref(BuyFractal,1) );

PlotShapes(IIf(NewSellFractal,shapeDownArrow,shapeNone),colorRed,0,High,Offset=-12);
PlotShapes(IIf(NewBuyFractal,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-12);

_SECTION_END();
=====================================================

Sample Banknifty chart showing trades

 

Similar threads