Need afl for AHR-ADR-AWR

Discussion in 'AmiBroker' started by ford7k, Oct 5, 2011.

  1. HULK

    HULK Active Member

    Joined:
    May 25, 2010
    Messages:
    130
    Likes Received:
    121
    Trophy Points:
    43
    rvlv

    More then 10 days passed, you had not share here the code for rest of TJ Member ?

    HULK
     
  2. johnnypareek

    johnnypareek Well-Known Member

    Joined:
    Jun 14, 2006
    Messages:
    875
    Likes Received:
    595
    Trophy Points:
    93
    looks like he got what he wanted, now ghost. :(
     
  3. rvlv

    rvlv Active Member

    Joined:
    Jul 2, 2006
    Messages:
    445
    Likes Received:
    197
    Trophy Points:
    43
    Location:
    Hyderabad & Muscat,Oman
    Hi HULK

    I was away on a business trip.
    so I could not post.in between new ghosts seem to have arrived on scene.
    A GHOST DOES JUST ONE THING-POINT FINGERS.comment- kill motivation.


    anyways here is what I got. Seems something is amiss.
    the chart is not upto expectation. Feel I cant use this for my needs.
    hope the ghost can contribute something to make it usable.
    --------------------------

    //DAILY ADR



    HD1 = TimeFrameGetPrice("H", inDaily, -1);
    LD1 = TimeFrameGetPrice("L", inDaily, -1);
    M1 = HD1 - LD1;//THIS WILL GIVE YOU 1 DAY ADR

    HD2 = TimeFrameGetPrice("H", inDaily, -2);
    LD2 = TimeFrameGetPrice("L", inDaily, -2);
    M2 = HD2 - LD2;

    HD3 = TimeFrameGetPrice("H", inDaily, -3);
    LD3 = TimeFrameGetPrice("L", inDaily, -3);
    M3 = HD3 - LD3;

    HD4 = TimeFrameGetPrice("H", inDaily, -4);
    LD4 = TimeFrameGetPrice("L", inDaily, -4);
    M4 = HD4 - LD4;

    HD5 = TimeFrameGetPrice("H", inDaily, -5);
    LD5 = TimeFrameGetPrice("L", inDaily, -5);
    M5 = HD5 - LD5;
    //5DAY ADR
    AD5 = (M1+M2+M3+M4+M5)/5; // This will give you 5 Days ADR

    //Like this keep adding loop for 10 days(AD10) then 20 days (AD20)
    HD6 = TimeFrameGetPrice("H", inDaily, -6);
    LD6 = TimeFrameGetPrice("L", inDaily, -6);
    M6 = HD6 - LD6;//THIS WILL GIVE YOU 6TH DAY ADR

    HD7 = TimeFrameGetPrice("H", inDaily, -7);
    LD7 = TimeFrameGetPrice("L", inDaily, -7);
    M7 = HD7 - LD7;

    HD8 = TimeFrameGetPrice("H", inDaily, -8);
    LD8 = TimeFrameGetPrice("L", inDaily, -8);
    M8 = HD8 - LD8;

    HD9 = TimeFrameGetPrice("H", inDaily, -9);
    LD9 = TimeFrameGetPrice("L", inDaily, -9);
    M9 = HD9 - LD9;

    HD10 = TimeFrameGetPrice("H", inDaily, -10);
    LD10 = TimeFrameGetPrice("L", inDaily, -10);
    M10 = HD10 - LD10;

    AD10 = (M1+M2+M3+M4+M5 +M6+M7+M8+M9+M10)/10; // This will give you 10 Days ADR


    HD11 = TimeFrameGetPrice("H", inDaily, -11);
    LD11 = TimeFrameGetPrice("L", inDaily, -11);
    M11 = HD11 - LD11;//THIS WILL GIVE YOU 11 DAY ADR

    HD12 = TimeFrameGetPrice("H", inDaily, -12);
    LD12 = TimeFrameGetPrice("L", inDaily, -12);
    M12 = HD12 - LD12;

    HD13 = TimeFrameGetPrice("H", inDaily, -13);
    LD13 = TimeFrameGetPrice("L", inDaily, -13);
    M13 = HD13 - LD13;

    HD14 = TimeFrameGetPrice("H", inDaily, -14);
    LD14 = TimeFrameGetPrice("L", inDaily, -14);
    M14 = HD14 - LD14;

    HD15 = TimeFrameGetPrice("H", inDaily, -15);
    LD15 = TimeFrameGetPrice("L", inDaily, -15);
    M15 = HD15 - LD15;


    HD16 = TimeFrameGetPrice("H", inDaily, -16);
    LD16 = TimeFrameGetPrice("L", inDaily, -16);
    M16 = HD16 - LD16;//THIS WILL GIVE YOU 16TH DAY ADR

    HD17 = TimeFrameGetPrice("H", inDaily, -17);
    LD17 = TimeFrameGetPrice("L", inDaily, -17);
    M17 = HD17 - LD17;

    HD18 = TimeFrameGetPrice("H", inDaily, -18);
    LD18 = TimeFrameGetPrice("L", inDaily, -18);
    M18 = HD18 - LD18;

    HD19 = TimeFrameGetPrice("H", inDaily, -19);
    LD19 = TimeFrameGetPrice("L", inDaily, -19);
    M19 = HD19 - LD19;

    HD20 = TimeFrameGetPrice("H", inDaily, -20);
    LD20 = TimeFrameGetPrice("L", inDaily, -20);
    M20 = HD20 - LD20;

    AD20 = (M1+M2+M3+M4+M5 +M6+M7+M8+M9+M10+M11+M12+M13+M14+M15 +M16+M17+M18+M19+M20)/20; // This will give you 20 Days ADR


    //then add line
    WDR = (M1+AD5+AD10+AD20)/4;// THIS WILL GIVE YOU WDR

    Plot(WDR,"WADR",colorBlue,styleDots+styleThick);//NOW PLOT WDR

    //Plot(C,"C",colorBlack,styleOwnScale,styleCandle);




    _SECTION_BEGIN("Price1");
    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() );

    regards
     
  4. HULK

    HULK Active Member

    Joined:
    May 25, 2010
    Messages:
    130
    Likes Received:
    121
    Trophy Points:
    43
    Rvlv

    I didnt got u dear, why result is not as per ur expectation
    Code is draft based on your input only
    Let me know what left

    WDR = (is avg of last 1 day adr + last 5 days adr + last 10 days adr + last 20 days adr ) /4


    HULK
     
  5. johnnypareek

    johnnypareek Well-Known Member

    Joined:
    Jun 14, 2006
    Messages:
    875
    Likes Received:
    595
    Trophy Points:
    93
    hmmmmm,

    well, now on my mouth will be shut.




    johnnypareek( 3/11/11 1:35:47 PM) : NIFTY FUT -- buy 5245 tgt open

    johnnypareek( 3/11/11 1:41:29 PM) : Give me cash nifty above 5236 n rest will really enjoyable

    ashit_cg( 3/11/11 1:46:45 PM) : lo de diya 5236 ab kya

    johnnypareek( 3/11/11 1:59:23 PM) : NIFTY fut - move SL to 5252

    johnnypareek( 3/11/11 2:43:35 PM) : NIFTY FUT -- Raise SL to 5264 n lock some profit

    johnnypareek( 3/11/11 2:50:03 PM) : NIFTY FUT -- Raise SL to 5279 n lock some profit CALL WAS GIVEN AT 5245

    hmmm rest u can chk intraday chart.

    well, I just told in other thread that will not post, but I can not resist my self.



    yahoo ID : johnnypareek@ya hoo.c o m (remove space)

    johnny



     
    Last edited: Nov 3, 2011
  6. rvlv

    rvlv Active Member

    Joined:
    Jul 2, 2006
    Messages:
    445
    Likes Received:
    197
    Trophy Points:
    43
    Location:
    Hyderabad & Muscat,Oman
    Hi HULK

    Thanks for asking.
    What I said is the chart is not comfortable to use it for trading.
    the price plot is not visibly comfortable to look at or judge your to do action.

    The code is as per input but the chart based picture is not helpful to give a guidance.

    My humble thanks for ford to initiate this idea and HULK to try his best to put things in order as afl.
    I feel bad that at this point i have no ideas as to how best this code can be utiised.for trading. I buzzed couple of friends.

    HULK
    I HAVE COUPLE OF MT4 CODES TO BE TRANSFERRED TO AFL FORMAT.
    ANY CHANCE YOU CAN HELP
    let me know if any possibility exists
    regards

    PS
    I never meant to hurt anybodys feelings.I just wanted to say-just think the other human being has his own headaches and sometimes it is just not possible to meet any time deadlines.
     

  7. ajay8000

    ajay8000 New Member

    Joined:
    Jul 11, 2009
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    3
    Hello everybody, i am a new member i also need help regarding this topic, few year back i have a mt4 indicator,according to which i use to trade silver. in which i get yesterday range in 1 corner on screen like if hi lo is 45000-46000, i will get 1000 point range at chart.

    same i get 5 day average range like 1000+1100+1200+1300+1200= 1160

    & same for last 20 days.

    if till evening before USA mkt open silver move in just 400 point than i assume silver will move 500-600 point more after US mkt open & lot of data comes, so i put order to buy above day high & sell below day low for 500 point tgt & 250 point sl (risk reward 1:2).

    so can any body help to get such afl, where on screen we can see range in numbers (written like 10 point or 50 or 200) , no need for lines extra.


    thks
     
    chilgu likes this.
  8. ocil

    ocil Well-Known Member

    Joined:
    Nov 17, 2010
    Messages:
    523
    Likes Received:
    316
    Trophy Points:
    63
    check this :-
    /////////////////////////////////////////////////

    HiDay = TimeFrameGetPrice("H", inDaily);
    LoDay = TimeFrameGetPrice("L", inDaily);
    HiHrly = TimeFrameGetPrice("H", inHourly);
    LoHrly = TimeFrameGetPrice("L", inHourly);
    PlotShapes(shapeSmallCircle*(H==HiDay),colorDarkRed,0 ,H,20);
    PlotShapes(shapeSmallCircle*(L==Loday),colorDarkGreen,0 ,L,-20);

    Title =
    EncodeColor(colorBlack)+ "Hi-Lo" + " | " + Name() + " | " + EncodeColor(colorBlack)+ Interval(2)
    + EncodeColor(colorBlack) + " | " + Date() +" | "
    +"\n"+EncodeColor(1) +"Open ="+O +","+" High ="+H +" ,"+" Low ="+L +","+ " Close ="+C + " | Volume : "+ WriteVal(V,1.0)+
    "\n"+ EncodeColor(colorBlack)+"\n"+


    EncodeColor(colorBlack) + "Day's Range = " + EncodeColor(colorBlack) + StrToNum(NumToStr((HiDay - LoDay), 1.2))+ "\n"+
    EncodeColor(colorBlack) + "Day's Hi = " + EncodeColor(colorBlack) + Hiday + "\n" +
    EncodeColor(colorBlack) + "Day's Lo= " + EncodeColor(colorBlack) + Loday ;

    DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
    DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
    DayC = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
    DayO = TimeFrameGetPrice("O", inDaily); // current day open
    numbars = LastValue(Cum(Status("barvisible")));
    hts = -33.5;

    YHL = 1;
    if(YHL==1) {
    Plot(DayL,"YL",colorTurquoise,styleNoLine|styleNoLine|styleNoRescale|styleNoTitle);
    Plot(DayH,"YH",colorTurquoise,styleNoLine|styleNoLine|styleNoRescale|styleNoTitle);
    PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorBlack);
    PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorBlack);
    }

    /////////////////////////////////////////////////////////////////////////////////////////
     
  9. ajay8000

    ajay8000 New Member

    Joined:
    Jul 11, 2009
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    3
    Facing error. file attached.
     

    Attached Files:

  10. ocil

    ocil Well-Known Member

    Joined:
    Nov 17, 2010
    Messages:
    523
    Likes Received:
    316
    Trophy Points:
    63
    Check its working ,remove the space.
     
Loading...

Share This Page