Quantcast Amibroker FAQ - Aussie Stock Forums - Page 79

Page 79 of 91 FirstFirst ... 296978798089 ... LastLast
Results 1,561 to 1,580 of 1808

Thread: Amibroker FAQ

  1. #1561

    Default Re: Amibroker FAQ

    Quote Originally Posted by Gringotts Bank View Post
    Slow K% stochastic. Anyone know how to plot this please?
    Have you looked in the Amibroker User Guide? Check STOCHK function.

  2. #1562

    Default Re: Amibroker FAQ

    Thanks Trash
    Sorry the late acknowledgment had a whole lot of weather and not a whole lot of power here in the west.
    Should have known this code was buried somewhere in the AB manual appreciate your pointing me in the right direction.
    M of Perth

  3. #1563

    Default Re: Amibroker FAQ

    Switch(ExposureVal)
    {
    Case < 0.10:
    1;
    Case (>=0.1 AND <=0.2):
    2;
    Case >0.2:
    3;
    }

    Is it valid to use boolean logic in case statements as per above or do case values have to be discrete numbers as shown in the AB manual?
    M of Perth

  4. #1564

    Default Re: Amibroker FAQ

    Quote Originally Posted by AlterEgo View Post
    Have you looked in the Amibroker User Guide? Check STOCHK function.
    Have tried that alter. Not much help. Online searches not really helping much either. Anyone? SlowK?
    Note to self: Big upside patterns (R1). Profit target 90% R1/R2.

  5. #1565

    Default Re: Amibroker FAQ

    Quote Originally Posted by Gringotts Bank View Post
    Have tried that alter. Not much help. Online searches not really helping much either. Anyone? SlowK?
    http://stockcharts.com/school/doku.p...tic_oscillator

  6. #1566

    Default Re: Amibroker FAQ

    Hello

    I need a bit of help with the following afl. I want to be able to manually enter an entry date in parameters and plot a target line 5% below the entry date. Could someone please tell me what I have wrong. I get an error in the plot.



    HTML Code:
    Plot( C, "Close", colorBlack , styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
    BuyStartDate = ParamDate( "Buy Start Date", "2012-06-01" );
    EndDate = ParamDate( "Last Buy Date", "2020-01-01" );
    DateOK = IIf(DateNum() >= BuyStartDate  , 1, 0); //AND DateNum() <= EndDate
    
    Short =  Close>1  AND DateOK  ; ShortPrice=Close;
    Cover = RSI(5 ) < 20; CoverPrice=Close;
    
    entry = ShortPrice;
    target1 = entry - (entry * .050);
    
    
    end = LastValue( BarIndex() );
    
    Plot(LineArray(buystartdate,target1, end ,target1,1), "", colorOrange, styleLine);  
    //LineArray( x0, y0, x1, y1, extend = 0, usebarindex = False )

  7. #1567

    Default Re: Amibroker FAQ

    Thanks mate.
    Note to self: Big upside patterns (R1). Profit target 90% R1/R2.

  8. #1568

    Default Re: Amibroker FAQ

    Quote Originally Posted by tech/a View Post
    Show me a long only system that performs well in a sideways or bear market.
    No problems. Inspired by the same book.

    PHP Code:
    PositionSize = -20;
    PositionScore C/10;

    XAO Foreign("XSO","Close");
    XAOMA MA(XAO75);

    Buy Sell 0;

    SetTradeDelays(1111);
    BuyPrice Close;
    SellPrice Close;

    Length 260;    // 1 year

    BuySig =
        
    Close HHV(Ref(Close, -1), Length)
        AND 
    XAO XAOMA
        
    ;

    SellSig =
        
    Close RefLLV(CloseLength), -1)
        OR 
    XAO XAOMA
        
    ;

    Buy ExRem(BuySigSellSig);
    Sell ExRem(SellSigBuySig);

    ApplyStop(stopTypeLossstopModePercentamount 25False ); 
    Backtest filtered by ASX All Ordinaries (2012), 100K initial equity, min $5000 pos, $35 per trade, no more than 1% of entry bar volume.

    Jan 2011 - Jun 2012. CAR = 22.33%, MDD = -8.03%

    Jan 2004 - Jun 2012. CAR = 21.00%, MDD = -26.41%

    Will not make you rich overnight and not that I would trade this system myself, but this an Amibroker thread, not the trading one.
    Attached Images

  9. #1569

    Default Re: Amibroker FAQ

    Thanks

  10. #1570

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    Could someone please tell me what I have wrong. I get an error in the plot.
    Your code has many errors. First, ParamDate without the third parameter returns an integer in DateNum format, which is rather useless in plots. Second, ShortPrice is an array, as a result all the rest - entry and target1 are arrays too, and LineArray accepts only numbers. Third, 1st parameter in LineArray is a bar index, not a DateNum.Try following and be prepared not to see the line if BuyStartDate is far outside the visible range.
    PHP Code:
    PlotC"Close"colorBlack styleNoTitle ParamStyle("Style") | GetPriceStyle() ); 
    BuyStartDate _DTParamDate"Buy Start Date""2012-06-01"1) );
    EndDate _DTParamDate"Last Buy Date""2020-01-01"1) );
    DateOK IIf(DateNum() >= BuyStartDate  10); //AND DateNum() <= EndDate

    Short =  Close>1  AND DateOK  ShortPrice=Close;
    Cover RSI() < 20CoverPrice=Close;

    entry Lookup(ShortPriceBuyStartDate, -1);
    target1 entry - (entry .050);


    end LastValueBarIndex() );

    Plot(LineArray(Lookup(BarIndex(), BuyStartDate), target1end ,target11), ""colorOrangestyleLine);  
    //LineArray( x0, y0, x1, y1, extend = 0, usebarindex = False ) 

  11. #1571

    Default Re: Amibroker FAQ

    Hi qsb6irfa

    Thanks for telling me that. I dont have any experience with date/ bar index sort of equations and Ive spent a large chunk of the weekend trying to learn. When you look up the amibroker help files their are heaps of different date related types and it becomes a massive learning curve. Im stumped! The original idea came from a formula that I have posted below that plots 3 targets on a chart after a break of support or resistance. All I am trying to do is edit it so instead of it using a break of support or resistance to initiate the target lines I want to manually enter a date in parameters to start it. I cant find any afl's on the net that I can learn from so I really need some help. The last thing I tried was

    Short =Cross( DateNum(),ParamDate( "Start Date","2012-05-01",0 ));

    but this is probably wrong too based on what you have said. Do I have to write a loop for the entry or is it just something simple? Is paramdate ok to use? Sorry Ive run out of ideas



    HTML Code:
    Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
    
    
    
    showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
    
    res=HHV(H,10);
    sup=LLV(L,10);
    avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
    avn=ValueWhen(avd!=0,avd,1);
    s5d=IIf(avn==1,sup,res);
    
    if (showsl == 0)
    {Plot(s5d,"Stop Loss",colorCustom14,styleDots);}
    exitlong = Cross(s5d, H);
    PlotShapes(exitlong * shapeNone, colorBlack,0,H,-10);
    exitshort = Cross(L, s5d);
    PlotShapes(exitshort * shapeNone, colorBlack,0,L,-15);
    
    Buy = exitshort;
    Sell = exitlong;
    
    Buy = ExRem(Buy,Sell);
    Sell = ExRem(Sell,Buy);
    
    
    
    for(i=BarCount-1;i>1;i--)
    {
    if(Buy[i] == 1)
    {
    entry = C[i];
    sig = "BUY";
    sl = s5d[i];
    tar1 = entry + (entry * .050);
    tar2 = entry + (entry * .075);
    tar3 = entry + (entry * .100);
    
    bars = i;
    i = 0;
    }
    if(Sell[i] == 1)
    {
    sig = "SELL";
    entry = C[i];
    sl = s5d[i];
    tar1 = entry - (entry * .050);
    tar2 = entry - (entry * .075);
    tar3 = entry - (entry * .100);
    
    
    bars = i;
    i = 0;
    }
    }
    Offset = 20;
    Clr = IIf(sig == "BUY", colorLime, colorRed);
    ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
    sl = ssl[BarCount-1];
    
    Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine, Null, Null, Offset);
    Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine, Null, Null, Offset);
    Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine, Null, Null, Offset);
    
    _SECTION_END();

  12. #1572

    Default Re: Amibroker FAQ

    qsb6irfa thanks to you I have solved it. I thought a bit about what you said and I think the difference in the end was the zero on the end of the paramdate part.
    Short =Cross( DateNum(),ParamDate( "Start Date","2012-05-01",0 ));

    When I use this it works fine. Thanks mate!!

  13. #1573
    Andruha's Avatar
    Join Date
    May 2009
    Location
    Sydney's North-West
    Posts
    54

    Default Re: Amibroker FAQ

    Hi folks,

    Quick question for AB aficionados - is there a way to control text size for PlotText function?

    Thanks in advance

    Dre
    Concern should drive us into action and not into a depression. No man is free who cannot control himself.

  14. #1574

    Default Re: Amibroker FAQ

    Could someone help me plot the value of pSAR for the following day, as a small horizontal line on the chart, using this formula?


    SAR tomorrow = SAR today + AF(EP trade - SAR(today)

    where AF = acceleration factor, and EP = highest high reached yesterday

    I know this isn't the exact formula, but it's sort of close.



    Thanks.
    Note to self: Big upside patterns (R1). Profit target 90% R1/R2.

  15. #1575

    Default Re: Amibroker FAQ

    Quote Originally Posted by Andruha View Post
    Hi folks,

    Quick question for AB aficionados - is there a way to control text size for PlotText function?

    Thanks in advance

    Dre
    Take a look at GfxSelectFont()

  16. #1576

    Default Re: Amibroker FAQ

    Quote Originally Posted by Gringotts Bank View Post
    Could someone help me plot the value of pSAR for the following day, as a small horizontal line on the chart, using this formula?


    SAR tomorrow = SAR today + AF(EP trade - SAR(today)

    where AF = acceleration factor, and EP = highest high reached yesterday

    I know this isn't the exact formula, but it's sort of close.



    Thanks.
    Something along these lines should work:

    extendLine = 3;
    startPlot = BarCount - 1 - extendLine;
    SART = ****;
    Plot( C, "", color, styleBar);
    Plot( IIf( BarIndex() >= startPlot, LastValue(SART), Null), "", color, styleThick, Null, Null, extendLine );

  17. #1577

    Default Re: Amibroker FAQ

    Quote Originally Posted by colion View Post
    Something along these lines should work:

    extendLine = 3;
    startPlot = BarCount - 1 - extendLine;
    SART = ****;
    Plot( C, "", color, styleBar);
    Plot( IIf( BarIndex() >= startPlot, LastValue(SART), Null), "", color, styleThick, Null, Null, extendLine );
    Thanks colion, excellent.

    Just in case anyone else is wondering about the next day value for the pSAR, it will depend on OHLC values and may vary significantly during the day. Unfortunately there are many supposedly reputable websites that say you can calculate ahead of time what that value will be.
    Note to self: Big upside patterns (R1). Profit target 90% R1/R2.

  18. #1578
    Andruha's Avatar
    Join Date
    May 2009
    Location
    Sydney's North-West
    Posts
    54

    Default Re: Amibroker FAQ

    Quote Originally Posted by colion View Post
    Take a look at GfxSelectFont()
    Thank colion, however GfxSelectFont does not seem to effect PlotText().

    In order to benefit from it it seems I would need to use either GfxTextout or GxfGrawText and I've struggled to get either to work correctly. Is that right?
    Concern should drive us into action and not into a depression. No man is free who cannot control himself.

  19. #1579

    Default Re: Amibroker FAQ

    Quote Originally Posted by Andruha View Post
    Thank colion, however GfxSelectFont does not seem to effect PlotText().

    In order to benefit from it it seems I would need to use either GfxTextout or GxfGrawText and I've struggled to get either to work correctly. Is that right?
    Once you jump into low level graphics then as far then as I know you have to go in all the way. Have you seen the tutorial at http://www.amibroker.com/guide/h_lowlevelgfx.html? Of course, if you are satisfied with one font for the entire chart you can use Tools >> Preferences >> Miscellaneous to change the font. I believe that these are your two choices.

  20. #1580
    Andruha's Avatar
    Join Date
    May 2009
    Location
    Sydney's North-West
    Posts
    54

    Default Re: Amibroker FAQ

    Quote Originally Posted by colion View Post
    Once you jump into low level graphics then as far then as I know you have to go in all the way. Have you seen the tutorial at http://www.amibroker.com/guide/h_lowlevelgfx.html? Of course, if you are satisfied with one font for the entire chart you can use Tools >> Preferences >> Miscellaneous to change the font. I believe that these are your two choices.
    Thanks again colion.

    I shall have another stub at low-level graphics on the weekend again for my own benefit. But for now I will utilise the second method suggested by you.

    Cheers
    Concern should drive us into action and not into a depression. No man is free who cannot control himself.

Similar Threads

  1. How to get Amibroker to get automatic Yahoo ASX data feed?
    By flyhigher in forum Software and Data
    Replies: 23
    Last Post: 2nd-March-2011, 02:20 AM
  2. AmiBroker to TradeSim & Monte Carlo testing
    By stevo in forum Software and Data
    Replies: 15
    Last Post: 3rd-December-2009, 04:19 PM
  3. TechTrader With AmiBroker
    By Peakey in forum Software and Data
    Replies: 9
    Last Post: 31st-October-2009, 11:05 PM
  4. Getting EOD data into Amibroker (www.float.com.au)?
    By markrmau in forum Software and Data
    Replies: 36
    Last Post: 29th-December-2008, 12:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Aussie Stock Forums