Simple Coding Help - No Promise.

hello,
i was in search of EMA crossover scan. so I came across this code::

// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("EMA CrossOver");


Buy = BarsSince( Cross( EMA( Close, 50), EMA( Close, 100 ) ) ) <= 1;
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen);

Filter = BarsSince( Cross( EMA( Close, 50 ), EMA( Close, 100 ) ) ) <= 1;
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );
AddColumn(Filter,"Buy",1);
_SECTION_END();

but I think this only gives buy signal so I tried to edit code, can I someone help with this...

// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("EMA CrossOver");


Buy = BarsSince( Cross( EMA( Close, 50), EMA( Close, 100 ) ) ) <= 1;
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen);

Filter = BarsSince( Cross( EMA( Close, 50 ), EMA( Close, 100 ) ) ) <= 1;
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );
AddColumn(Filter,"Buy",1);
_SECTION_END();

Sell = BarsSince( Cross( EMA( Close, 100), EMA( Close, 50 ) ) ) <= 1;
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorBrightRed);

Filter = BarsSince( Cross( EMA( Close, 50 ), EMA( Close, 100 ) ) ) <= 1;
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );
AddColumn(Filter,"Sell",1);
_SECTION_END();



is this right ?? or need to change more
 
Hello Friends and Gurus ,
need your help in exploring the result ,
i have cash scripts in watchlist0 and futures in watchlist1 , Now when scripts have O==H or O==L in both watchlist it should show in explorer e.g iif ACC and ACC-1 both have O==H ,Then it should filter ACC in result ,
i have tried to put my query in best possible way , waiting for valuble repl
 
Hello Friends and Gurus ,
need your help in exploring the result ,
i have cash scripts in watchlist0 and futures in watchlist1 , Now when scripts have O==H or O==L in both watchlist it should show in explorer e.g iif ACC and ACC-1 both have O==H ,Then it should filter ACC in result ,
i have tried to put my query in best possible way , waiting for valuble repl
Exploration cannot use two watch lists concurrently but AFL can handle multple stocks together.
You will have to use watch list0, access individiual futures scrip using Foreign function and compare price data....
 
Exploration cannot use two watch lists concurrently but AFL can handle multple stocks together.
You will have to use watch list0, access individiual futures scrip using Foreign function and compare price data....
Thank you Mastermind for quick responce ,
sir i have kept cash scripts in watchlist0 and Futures in watchlist1 and also i have added both cash @ futures in watchlist3 ... i tried using Filter = O==H and inwatchlist(0) and inwatchlist(1) ; and Run Explorer on watchlist3 , but no correct result found , so kindly show me correct way to get this done .
Thank you
 
hello,
I open 2 charts in amibroker 5min and 30min. if I draw a rectangle on a 30min chart will it show on 5min chart also? because I don't see it drawing so was a little confused... is there any setting for this?
 

josh1

Well-Known Member
AVGcross.png

Hello,

Is it possible to plot pivot points for HHV and LLV between two crosses of Averages. Red line is 9MA and blue line is 20MA.
 
Hello,
Is it possible to plot pivot points for HHV and LLV between two crosses of Averages. Red line is 9MA and blue line is 20MA.
@josh1, Sir, Hope I have interpreted it correctly. Thnx.
Code:
_SECTION_BEGIN("Pivot Points between two MAs");
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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("MA");

MA9 = MA(C,9);
MA20 = EMA(MA( C, 9),20 );
Plot( MA9, "MA9", colorRed, styleline );
Plot( MA20, "MA20", colorbluegrey, styleline );

CrossUp = Cross(MA9,MA20);
CrossDn = Cross(MA20,MA9);

//Modified original code available at below location for the requirement
//https://www.traderji.com/community/threads/trading-with-obv-for-beginners-only.104279/

isemapvts = ParamToggle("Want Pivots ", "No|Yes", 1) ;
periodtype = 20;//max MA20 period
//Hi = HHV(H,20);   
//Lo = LLV(L,20);
PeriodUp = MA9>MA20;
Hi = HHV(H, PeriodUp);   
Lo = LLV(L,PeriodUp);

B1 = Cross(H,Ref(Hi,-1));   
S1 = Cross(Ref(Lo,-1),L);
B1 = ExRem(B1,S1);        S1 = ExRem(S1,B1);
UP1 = Flip(B1,S1);        DN1 = Flip(S1,B1);

ro = ParamField("Open", 0) ;
rh = ParamField("High", 1) ;
rl = ParamField("Low", 2) ;
rc = ParamField("Close", 3) ;

ismph = H-H ;
ismpl = L-L ;

if (isemapvts)
{

    if(periodtype)
    {
        upcross = b1;
        downcross = s1;
}

bi = BarIndex() ;

mphbar = HighestSinceBars(upcross, rH) ;
mplbar = LowestSinceBars(downcross, rL) ;

mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;



mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;

ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;

}

showpvtHiLoline = ParamToggle("Show Pvt Hi/Lo line", "No|Yes", 1) ;
if (showpvtHiLoline)
{

bi = Cum(1)-1;
cbar = Param("cbar",2,2,50,1);



P1 = ismph;//GetTop(Ch);
V1 = ismpl;//GetValley(Ch);
P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False, V1)),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);
RF=ValueWhen(P1,H);
SF=ValueWhen(V1,L);
RF1 = IIf(RF AND BarsSince(P1) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(V1) <=cbar,SF,Null);
Plot(RF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(SF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(RF,"Resist",colorOrange,40+16+2048);//2048 is stylenorescale
Plot(SF,"Suprt",colorbrightGreen,40+16+2048);

PlotText("Peak "+ WriteVal(RF,1.2), BarCount+2, SelectedValue(RF),colororange,colorDefault,5);
PlotText("Valley "+ WriteVal(SF,1.2), BarCount+2, SelectedValue(SF),colorbrightgreen,colordefault,5);

}

_SECTION_END();
PkVlybetweenAvg.png
 

josh1

Well-Known Member
Bhanushali.png


Thank You Bhanushali ji.

Beautifuly depicted price levels. Actually I wanted Peaks and Valleys for the smalle ma (9MA).
Let's try to find out how to do it.
 

Similar threads