• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Amibroker FAQ

Discussion in 'Software and Data' started by RichKid, Jul 15, 2005.

  1. edilsonsantos

    edilsonsantos

    Posts:
    10
    Likes Received:
    0
    Joined:
    Dec 11, 2011
    Captian black, sorry. BuyPrice is an array, but PriceAtBuy no, it is a single number. It is created for to be single number.
    I think "PriceAtBuy" only acquires a non-zero value inside the loop, when a buy signal (Buy = = 1) outside the loop. And "PriceAtBuy" retains this value until it is one of the other conditions in the rest of the loop is satisfied. That is the intent of the code. Am I wrong?
    As I think that the code works? In the beginning in the code, the bars are being evaluated for buy signal. When a buy signal and reaches the loop, all bars from that which generated the buy signal are evaluated. If some condition is met, an action is generated. If not, move on to the end. I may be wrong about what I believe is the logic of program operation.

    Thanks.
    Edilson
     
  2. rx2

    rx2

    Posts:
    66
    Likes Received:
    0
    Joined:
    Dec 9, 2010
    I think you will find every variable defined in AB is an array. If you create a variable PriceAtBuy = 2, it will just create an array n periods long with every array element set to the value of 2.
     
  3. tminus

    tminus

    Posts:
    129
    Likes Received:
    1
    Joined:
    Jul 1, 2008
    Is it possible to have Amibroker draw price bars without the open tick, like Tradeguider. For intraday charts the open tic isn't that useful, and by not show it IMO makes the graph easier to read. Even MS.net charts package has an option to not draw the open tic.
    Here is an example in Tradeguider
    close dash.jpg
     
  4. captain black

    captain black

    Posts:
    1,281
    Likes Received:
    748
    Joined:
    Oct 24, 2005
    I use something similar to the code below on a modified Amibroker VPA chart:

    Code:
    PlotOHLC (Null, High, Low, Close, "" , ColorBlack, StyleBar|StyleThick );
    
    This code plots thick, black bars. I use coloured bars to give an indication of the trend and volume etc.
     
  5. edilsonsantos

    edilsonsantos

    Posts:
    10
    Likes Received:
    0
    Joined:
    Dec 11, 2011
    I've read a document here in AUSSIE: "Looping in Amibroker AFL". It is clear in this question about array and single number and it's my suggestion.

    Thanks.
    Edilson
     
  6. tminus

    tminus

    Posts:
    129
    Likes Received:
    1
    Joined:
    Jul 1, 2008
    Thanks that works fine, replacing ColorBlack, I can get different colours based on open and close.
    Code:
    IIf(C>O, IIf(H>C, colorRGB(72,170,222), colorRGB(53,83,218)), IIf(L<C, colorRGB(245,170,13), colorRGB(227,43,36)))
    
     
  7. captain black

    captain black

    Posts:
    1,281
    Likes Received:
    748
    Joined:
    Oct 24, 2005
    It's worth having a look at Karthik's VPA code as well to pick up a few ideas. It uses LinRegSlope calculations to change the bar colours depending on whether price is trending or in accumulation/distribution zones. I also have bars with extreme volume a particular colour as well.
     
  8. tminus

    tminus

    Posts:
    129
    Likes Received:
    1
    Joined:
    Jul 1, 2008
    I looked at it sometime back and looked to complicated, but I do use my own method for classifying relative volume.
     
  9. edilsonsantos

    edilsonsantos

    Posts:
    10
    Likes Received:
    0
    Joined:
    Dec 11, 2011
    I'm interested in identifying the value of the line signal of the MACD in the penultimate top. In the last one I am using the function ValueWhen (LastTop, Signal ()).
    Could anyone help me?

    Thanks.
    Edilson
     
  10. howardbandy

    howardbandy

    Posts:
    838
    Likes Received:
    93
    Joined:
    Jun 13, 2007
    Hi Edilson --

    ValueWhen has three parameters. From the AmiBroker Useer's Guide:

    -----------------

    VALUEWHEN
    - get value of the array when condition met Trading system toolbox
    (AFL 1.1)


    SYNTAX valuewhen(EXPRESSION, ARRAY, n = 1)
    RETURNS ARRAY
    FUNCTION Returns the value of the ARRAY when the EXPRESSION was true on the n -th most recent occurrence. Note: this function allows also 0 and negative values for n - this enables referencing future
    EXAMPLE valuewhen( cross( close, ma(close,5) ) ,macd(), 1)

    --------------

    If it is omitted, the third parameter has a default value of 1. To return the value one occurrence earlier, use a 2.

    Your example would be:
    xxx = ValueWhen (LastTop, Signal (), 2);

    Thanks,
    Howard
     
  11. edilsonsantos

    edilsonsantos

    Posts:
    10
    Likes Received:
    0
    Joined:
    Dec 11, 2011
    Howard,
    Thank you.
    Edilson
     
  12. boofis

    boofis

    Posts:
    587
    Likes Received:
    0
    Joined:
    Nov 7, 2010
    Tried searching but had no luck. Trying to view a weekly and daily chart of the same stock in different panes but on the same sheet in Amibroker. :S Help?
     
  13. xyz246

    xyz246

    Posts:
    13
    Likes Received:
    0
    Joined:
    Oct 25, 2009
    Boofis...Is this what you are after:

    SetChartBkGradientFill(colorWhite,colorLightGrey,colorWhite);
    Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Minute|5Minute|1Minute",0);

    if(Period=="Monthly"){
    TimeFrameSet(inMonthly);
    PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="Weekly"){
    TimeFrameSet(inWeekly);
    PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="Daily"){
    TimeFrameSet(inDaily);
    PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="Hourly"){
    TimeFrameSet(inHourly);
    PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="15Minute"){
    TimeFrameSet(in15Minute);
    PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="5Minute"){
    TimeFrameSet(in5Minute);
    PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }
    if(Period=="1Minute"){
    TimeFrameSet(in1Minute);
    PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
    Plot(V,"Volume",colorWhite, styleHistogram);
    }



    Cheers
     
  14. xyz246

    xyz246

    Posts:
    13
    Likes Received:
    0
    Joined:
    Oct 25, 2009
    Boofis....1st line not displayed correctly....
    delete space ..... ........ c olorWhite); s/be colorWhite

    Cheers
     
  15. boofis

    boofis

    Posts:
    587
    Likes Received:
    0
    Joined:
    Nov 7, 2010
    Appreciate it, thanks mate. Yeah got the error when I entered it, no dramas!
     
  16. Gringotts Bank

    Gringotts Bank

    Posts:
    6,175
    Likes Received:
    604
    Joined:
    Jun 30, 2007
    Hi,

    Can Amibroker import market depth from a live intra-day data feed?

    I was thinking it would be nice to have a custom indicator say "buyers:sellers ratio" or "best buy vs best sell".

    If it's possible, can this data be included in a scan/exploration? eg. scan for stocks where # best buyers > # best sellers.

    I know some data feeds can provide this info, just not sure if AB can use it.

    Thanks.
     
  17. Synergy

    Synergy

    Posts:
    358
    Likes Received:
    0
    Joined:
    Feb 26, 2007
    Can anyone help me with restricting my symbols to those with only 3 characters?

    Either in the importing of the data initially or in the coding where the buy's are selected.

    I'd prefer it to be done when I import the data if possible...
     
  18. captain black

    captain black

    Posts:
    1,281
    Likes Received:
    748
    Joined:
    Oct 24, 2005
    To filter symbols to 3 characters in code use:

    Code:
    Buy = StrLen ( Name () ) == 3;
    
     
  19. Synergy

    Synergy

    Posts:
    358
    Likes Received:
    0
    Joined:
    Feb 26, 2007
    Cheers Capt.

    Works a treat :)

    How I couldn't find that on google I've got no idea.
     
  20. Synergy

    Synergy

    Posts:
    358
    Likes Received:
    0
    Joined:
    Feb 26, 2007
    Why would I be getting varying results for backtests depending on the date range i select?

    For example trades that should be taken this week are taken if i set the start date to 1/1/12, but not if i set it to 1/1/11. I can't work out why this would be.

    Its also very frustrating that the backtest window just seems to dissapear when i minimize it! Am i doing something wrong?
     
Loading...

Share This Page