Simple Coding Help - No Promise.

C-like:
_SECTION_BEGIN("Open Range Breakout");

xf = ParamList("TF","5M|10M|15M|30M|H",2);
ShowORB = ParamToggle("Show Opening Range", "Show|Hide", 1);

if(ShowORB == 1)
{
SetBarsRequired(-2,-2); //Turn Quick AFL Off

spacer = IIf(xf == "5M",500,IIf(xf == "10M",1000,IIf(xf == "15M",1500,IIf(xf == "30M",3000,IIf(xf == "H",6000,1)))));
tf = IIf(xf == "5M",300,IIf(xf == "10M",600,IIf(xf == "15M",900,IIf(xf == "30M",1800,IIf(xf == "H",6000,1)))));

newday = Day() != Ref(Day(),-1);  //check if new day or
starttime = ValueWhen(newday,TimeNum());

IBendtime = starttime+spacer;
minh = ValueWhen(newday,TimeFrameGetPrice("H",tf));
minl = ValueWhen(newday,TimeFrameGetPrice("L",tf));

printf("%g",IBendtime);
ORBH = IIf(TimeNum() < IBendtime, Null ,minh);
ORBL = IIf(TimeNum() < IBendtime, Null, minl);
Rangehi = LastValue(ORBH);
Rangelo = LastValue(ORBL);
Plot(ORBH,"ORBH",ParamColor("ORH",colorYellow),styleNoTitle);
Plot(ORBL,"ORBL",ParamColor("ORL",colorYellow),styleNoTitle);
PlotOHLC(ORBL,ORBH,ORBL,ORBH,"ORB",ParamColor("OR",colorGrey40),styleCloud|styleNoLabel|styleNoTitle,0,0,0,-1);

Filter = Param("Filter",5,0,100,0.01,0);

UT = Ref(C,-1)> Rangehi+Filter;
DT = Rangelo-Filter > Ref(C,-1);

Hor=Param("Horizontal Position",500,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
FS=Param("Font Size Trend",34,11,100,1);
//T= ParamList("Trend", "Select Trend|Sideways|Short Only|Long Only");
GfxSetBkMode( 1 );
GfxSelectFont( "Arial", FS, 700, italic = False, underline = False, True );
GfxSetTextColor(ParamColor("ColorTrend",colorWhite) );
GfxSetOverlayMode( mode = 1 );
IIf(UT,GfxTextOut("minor Up Trend "+UT , Hor,Ver ),IIf(DT,GfxTextOut( "minor Down Trend " + DT , Hor,Ver+20 ),GfxTextOut( "Sideways", Hor,Ver+40 )) );

}

_SECTION_END();
Can anybody tell me what is wrong with last iif statement in the baove code? I am getting all the three options printed in chart.
View attachment 37200
Hi josh..
I am trying to auto execute orders from ami to nest.
I am using finvasia and I think in finvasia is not supporting automatic order execution .
.
Do you have idea about this and any vendor that is supporting auto execution from ami to nest
Thanks
 
Hi josh..
I am trying to auto execute orders from ami to nest.
I am using finvasia and I think in finvasia is not supporting automatic order execution .

Do you have idea about this and any vendor that is supporting auto execution from ami to nest
Thanks
@against_tides: Have you tried @TracerBullet: "OrderMan" utility! - have a look. On the other hand you can also check with "Symphony" they have launched "Compositedge XT-Fuse AmiBroker Automation" utility and it is FREE and easy to use (yes the broker will be Compositedge). Thnx
@Moderator: I have no affiliation with either "Symphony" or "Compositedge" and if you feel I am violating "Forum Rules", please delete this message.
 
@against_tides: Have you tried @TracerBullet: "OrderMan" utility! - have a look. On the other hand you can also check with "Symphony" they have launched "Compositedge XT-Fuse AmiBroker Automation" utility and it is FREE and easy to use (yes the broker will be Compositedge). Thnx
@Moderator: I have no affiliation with either "Symphony" or "Compositedge" and if you feel I am violating "Forum Rules", please delete this message.
Thanks dear..
I was looking for it for many days..:)
 

josh1

Well-Known Member
Hi josh..
I am trying to auto execute orders from ami to nest.
I am using finvasia and I think in finvasia is not supporting automatic order execution .
.
Do you have idea about this and any vendor that is supporting auto execution from ami to nest
Thanks
It's GDFL. I think ZERODHA is having collaboration with them.
 
No. If you see the afl in the link i posted, it plots swing high and low values on chart. what i want is to create an exploration and when i scan for that exploration it should display the latest swing high and latest swing low value for each stock. I want the latest swing high and low of hindalcoas 183.6 and 180.4 and similarly for all the stocks when i do the exploration. hope you are getting my point

@Happy_Singh .please help. thanks
@john302928: John-saab, I have used different code but the results should be same (if you tweek in parameters for the lookback period). Hope it helps. Thnx.

Code:
_SECTION_BEGIN("SUPPORT AND RESISTANCE_using moving average Exploration)");

//original code available at - https://forum.amibroker.com/t/swing-high-swing-low-afl-code/3361/14

LB= Param("Look back periods HH,LL",6,1,30,1);
R=ValueWhen(Cross(MA(C,LB),C),HHV(H,LB),1);
S=ValueWhen(Cross(C,MA(C,LB)),LLV(L,LB),1);

// if required to see Support and Resistance select "Show" from parameters
SupResInclude = ParamToggle("SUPPORT AND RESISTANCE","HIDE|SHOW",0);
if( SupResInclude )
{
    Plot( R, "Resistant", colorGreen, 24 );
    Plot( s, "Support", colorRed, 24 );
}

// price plot
Plot( C, "Close", colorDefault, stylebar );

// if required to see moving average select "Yes" from parameter
if( ParamToggle("Plot Mov Average ?", "No|Yes" ) ) Plot( MA(C,LB), "Mov", colorred, styleline );


//-- Code For Exploration
if( Status( "Action" ) == actionExplore )
{
 
    Filter = R OR S;
    AddTextColumn( Interval(2), "Set Interval", 1 );
    AddColumn(R, "Swing High",1.2);
    AddColumn(S, "Swing Low",1.2);
    SetSortColumns( -2,1);

}

_SECTION_END();
 
Can any senior member code this codition...
Buy when green candle give breakout above. Upper band of Bollinger band
Sell for vice versa means sell signal should generate if red candle give breakout below lower band of bollinger band.
breakout should be closing candle
This breakout should visible i mean arrow.
And exploration on all time frames....
Romeo sir pls if u can make this afl.
Thanks in advance.
 
Last edited:
Friends

I need help for below MACD AFL. I need to get add BUY/Sell symbol which needs to support ROBO. Please help me to add symbols.



//MACD above Zero Line

//RSI Above 30

//This system is base on trend trading. Buying on pullback when the market continue its up trend.

r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
ParamColor("MACD color", colorAqua ), ParamStyle("MACD style",
styleThick) );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
ParamColor("Signal color", colorRed ), ParamStyle("Signal style",
styleThick) );
//Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram ) );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
Hist= m1-s1;
Histprev=Ref(Hist,-1);

Color = IIf(Hist>Histprev,ParamColor("MACD-H Up Color", colorGreen),
IIf(hist<histprev,ParamColor("MACD-H Down
Color",colorCustom16),colorRed));

Plot(m1-s1,"MACD Histogram",Color,styleHistogram|styleNoTitle|styleThick);

SetChartBkGradientFill( ParamColor("Backgroud Top Color",
colorRed),ParamColor("Background Bottom Color", colorDarkGrey));

//This indicator shows the value of tomorrow's Closing Price
//in order for the slope of the MACD Histogram to change Direction.
//(ie. changing from a positive slope to a negative slope OR changing
//from a negative slope to a positive slope)
GraphXSpace = 8;

f1 = ((r3+1)*M1-2*S1)/(r3-1);
f2 = EMA(C,r1)*(r1-1)/(r1+1);
f3 = EMA(C,r2)*(r2-1)/(r2+1);
f4 = 2/(r1+1) - 2/(r2+1);

dcv = (f1-f2+f3)/ f4;

Title = Name() + " - " + FullName() + " - " + Date() + " - Close
= " +
WriteVal(C,0.3) + " - DCV = " + WriteVal(dcv,0.3);

Up = Cross(ml, sl);
Dn = Cross(sl, ml);
PlotShapes(Up*shapeUpArrow,colorGreen);
PlotShapes(Dn*shapeDownArrow,colorRed);

Plot(C,"",colorYellow,64 | styleOwnScale);
 
Here is the modified code with Buy Sell added.

_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
ParamColor("MACD color", colorAqua ), ParamStyle("MACD style",
styleThick) );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
ParamColor("Signal color", colorRed ), ParamStyle("Signal style",
styleThick) );
//Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style",styleHistogram | styleNoLabel, maskHistogram ) );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
Hist= m1-s1;
Histprev=Ref(Hist,-1);

Color = IIf(Hist>Histprev,ParamColor("MACD-H Up Color", colorGreen),
IIf(hist<histprev,ParamColor("MACD-H Down
Color",colorCustom16),colorRed));

Plot(m1-s1,"MACD Histogram",Color,styleHistogram|styleNoTitle|styleThick);

SetChartBkGradientFill( ParamColor("Backgroud Top Color",
colorRed),ParamColor("Background Bottom Color", colorDarkGrey));

//This indicator shows the value of tomorrow's Closing Price
//in order for the slope of the MACD Histogram to change Direction.
//(ie. changing from a positive slope to a negative slope OR changing
//from a negative slope to a positive slope)
GraphXSpace = 8;

f1 = ((r3+1)*M1-2*S1)/(r3-1);
f2 = EMA(C,r1)*(r1-1)/(r1+1);
f3 = EMA(C,r2)*(r2-1)/(r2+1);
f4 = 2/(r1+1) - 2/(r2+1);

dcv = (f1-f2+f3)/ f4;

Title = Name() + " - " + FullName() + " - " + Date() + " - Close
= " +
WriteVal(C,0.3) + " - DCV = " + WriteVal(dcv,0.3);

Up = Cross(ml, sl);
Dn = Cross(sl, ml);
Buy = Cross(ml, sl);
Sell = Cross(sl, ml);
Short = Sell;
Cover = Buy;
PlotShapes(Up*shapeUpArrow,colorGreen);
PlotShapes(Dn*shapeDownArrow,colorRed);

Plot(C,"",colorYellow,64 | styleOwnScale);
_SECTION_END();
 
// Downloaded From https://www.WiseStockTrader.com
Band= (BBandTop( C, 20, 2 ) - BBandBot( C, 20, 2)) / MA(Close, 20 ) * 100;
B= ((Close - BBandBot( Close, 20, 2 )) / (BBandTop( Close, 20, 2 ) - BBandBot(Close, 20, 2 ))) * 100;

Buy = band < 15 AND b > 95 AND MFI(10) > 60;
Sell = Cross(Close,SAR(0.01,0.2));
Short = band < 15 AND b < 5 AND MFI(10) < 40;
Cover = Cross(SAR(0.01,0.2), Close);

Filter = (band < 15 AND b > 95 AND MFI(10) > 60) OR (band < 15 AND b < 5 AND MFI(10) < 40);

NumColumns = 1;
Column0 = Close;

This is the afl of upper and lower Bollinger band touch afl bt I want exploration of price of closing of upper and lower band on all tf. pls anyone rectify it.
 

Similar threads