Australian (ASX) Stock Market Forum

Amibroker FAQ

Hello All,

Being relatively new to AB, I would welcome some help... :confused:

Basically, I've got a number of conditions which make up an "entry" signal and would like to know what the easiest way is on how I can plot this signal on a chart. ie. with the use of Arrows for example.

At the moment I just want to eyeball the results for the entry. Depending on how it performs, I will then look to add it to a system and test it further.


Any help much appreciated....


Chorlton
 
like to know what the easiest way is on how I can plot this signal on a chart. ie. with the use of Arrows for example.

Plot( C, " Close Price", colorGrey50, styleBar );
PlotShapes( shapeUpArrow*Buy, colorGreen, 0, L, -10 );
PlotShapes( shapeDownArrow*Sell, colorRed, 0, H, -10 );
 
Plot( C, " Close Price", colorGrey50, styleBar );
PlotShapes( shapeUpArrow*Buy, colorGreen, 0, L, -10 );
PlotShapes( shapeDownArrow*Sell, colorRed, 0, H, -10 );

Hi SB,

Thanks for the prompt reply.

Am I right in assuming that I just add the above to the bottom of my current code or should this be plotted as a different indicator?
 
Hi SB,

Thanks for the prompt reply.

Am I right in assuming that I just add the above to the bottom of my current code or should this be plotted as a different indicator?

SB,

Disregard the above question.... I tried adding the code to my existing code without success but realised I had made a mistake with it.

All sorted now....... :eek:

Thanks again..................
 
Hello All (again!!),

I've just created a simple system with Buy & Sell signals. I've plotted these on the chart as Buy/Sell arrows (thanks to SB for that bit of code!!).

Looking at the signals on the chart, currently every occurance of a Buy signal is shown.

However, what I'd like to do is have the FIRST occurance of the Buy signal shown differently.

That way when eyeballing the chart its clear as which point a trade would be entered after exiting a previous trade (1st new Occurance) and also when the system would allow me to add to my current position (all other Buy occurances prior to a new Sell signal appearing).

Does anyone else do something similar and if so, what additional code would I need to add?

Any help much appreciated,

Chorlton

PS. I am making my way through the 900 page manual...albeit slowly!!!!
 
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );

Edit: directly after your normal buy and sell.

SB,

Thanks again mate :)

btw: The more I play around with AB, the more I like it. The latest thing that has impressed me is the Formula Editor. Not only is it intuitive as you type but the Syntax Verifier is a great tool too.... especially for non-programmers....

Kind Regards,

Chorlton
 
Hi,

With regard to the Ref() function in AB, is there any way to pass a variable into it rather than using a specific value?

For example:

Rather than writing Ref(Close,-10), I want to write Ref(Close,-x) where x has been defined earlier in my code.


Thanks in advance,

Chorlton
 
From the users guide...

Functions accepting variable periods

The following functions support variable periods (where periods parameter can be array and change from bar to bar):
  • AMA
  • AMA2
  • DEMA
  • HHV
  • HHVBars
  • LinRegSlope
  • LinearReg
  • LinRegIntercept
  • LLV
  • LLVBars
  • MA
  • Ref
  • StdErr
  • TEMA
  • TSF
  • WMA
 
Chorlton,

Usually the quickest way to get an answer to that sort of question is trial and error. Just try it and see if it works.

Cheers,
GP
 
Chorlton,

Usually the quickest way to get an answer to that sort of question is trial and error. Just try it and see if it works.

Cheers,
GP

Hello,

To be honest, I did have a go at trying a few options but for some reason it didn't work. What I didn't do was check the manual in more detail. Given the size of it, I just did a search for Ref() function in the Help and read the basic definition of it. I realise that I do need to read the manual from cover to cover though but am just trying to read it when required :(

Anyway, In my code when I substitute the variable in my ref() function for a actual value then the code works!!??!!! Thats what has confused me...

Here's my code:

x = IIf(H == HHV(H, 30), 1, 0);
y = BarsSince(x);
y = y*-1;

Buy1 = x AND RSI(15) > Ref(RSI(15),y);
Buy2 = x AND RSI(15) > Ref(RSI(15),-5);

PlotShapes( shapeUpArrow*Buy1, colorGreen, 0, L, -10 );
PlotShapes( shapeUpArrow*Buy2, colorBlue, 0, H, -10 );

The Buy2 signal plots with no problems but Buy1 won't. I assumed it was because of the variable y in the Ref function.

I'll try a few other options........

Thanks....
 
Chorton,

Not sure if the timing is right but best advice is to use the Plot() command to view each part of your code.

Code:
x = IIf(H == HHV(H, 30), 1, 0);
//Plot( x, "x", colorBlue, styleLine);
y = BarsSince(x);
y = IIf( (Ref( y, -1) > 0 AND y == 0), Ref( y, -1), 0);
Plot( y, "y", colorYellow, styleLine);

z = Param( "delay", 5 , 1, 50, 1);
Buy1 = x AND AccDist() > Ref(AccDist(), -y);
Buy2 = x AND AccDist() > Ref(AccDist(), -z);

GraphXSpace = 10;
BackGround  = colorBlack;
Plot( C, " Close Price", colorWhite, styleBar );
PlotShapes( shapeUpArrow*Buy1, colorGreen, 0, L, -10 );
PlotShapes( shapeUpArrow*Buy2, colorBlue, 0, H, -10 );

Also, right click on the chart and play around with the Buy2 delay using "Parameters". :)

SB
 
SB,

I think i've managed to get my code working. To be honest, I'm not sure what I did to fix it :confused: but at least the buy signals are now showing... :)

Out of interest could you elaborate on the idea of using the Delay function for debugging purposes. Just interested in your thinking behind it :)

All the best...



Chorton,

Not sure if the timing is right but best advice is to use the Plot() command to view each part of your code.

Code:
x = IIf(H == HHV(H, 30), 1, 0);
//Plot( x, "x", colorBlue, styleLine);
y = BarsSince(x);
y = IIf( (Ref( y, -1) > 0 AND y == 0), Ref( y, -1), 0);
Plot( y, "y", colorYellow, styleLine);

z = Param( "delay", 5 , 1, 50, 1);
Buy1 = x AND AccDist() > Ref(AccDist(), -y);
Buy2 = x AND AccDist() > Ref(AccDist(), -z);

GraphXSpace = 10;
BackGround  = colorBlack;
Plot( C, " Close Price", colorWhite, styleBar );
PlotShapes( shapeUpArrow*Buy1, colorGreen, 0, L, -10 );
PlotShapes( shapeUpArrow*Buy2, colorBlue, 0, H, -10 );

Also, right click on the chart and play around with the Buy2 delay using "Parameters". :)

SB
 
Out of interest could you elaborate on the idea of using the Delay function for debugging purposes. Just interested in your thinking behind it

Elaboration is the chart. Add a comparison:

y = BarsSince(x);
Plot( y, "y", colorRed, styleLine); // compare this
y = IIf( (Ref( y, -1) > 0 AND y == 0), Ref( y, -1), 0);
Plot( y, "y", colorYellow, styleLine); // with this

Even if it is not what you wanted you'll see yourself.

Be interesting to know if your green signals lined up with the above or not.
 
ok, im very new to amibroker and need to know a few basics..
how to i get up shares eg. oxiana.
and get up watchlists
 
Hi Pan,

how to i get up shares eg. oxiana.
Oxiana is such a tricky one. I find it needs some persuasion and in this case rather than gentle, try some harsh. This little devil is so slippery that it often sneaks under the radar and I'm totally at a loss what to do sometimes with OXR. Makes me sooooo mad!!!

and get up watchlists
Ohh that's easy, try placing the mouse over the Amibroker icon and slowly (very slowly) moving it top to bottom. A tip is to be gentle trying to keep this motion as steady as possible. If you find the midpoint click it as quick as you can.

Once finished, have a look here.

 
Hello All,

I've recently coded an my own indicator for a stop loss and would like to reference it in a system that I am developing rather than re-writing the code again.

Does anyone know how I can do this?

I'm looking through the manual but its not obvious :confused:


Thanks in advance,

Chorlton
 
Hello All,

I've recently coded an my own indicator for a stop loss and would like to reference it in a system that I am developing rather than re-writing the code again.

Does anyone know how I can do this?

I'm looking through the manual but its not obvious :confused:


Thanks in advance,

Chorlton

Hi Chorlton --

Two possibilities come to mind --

1. Save the code in the /include subdirectory and have AmiBroker merge it into your new system with the #include directive. See page 120 of Quantitative Trading Systems.
2. Compile your stop loss as a dll, save it in the /plugins subdirectory, and call it whenever you need it. See Appendix A.

Will either of these work?

Thanks,
Howard
 
Hi Chorlton --

Two possibilities come to mind --

1. Save the code in the /include subdirectory and have AmiBroker merge it into your new system with the #include directive. See page 120 of Quantitative Trading Systems.
2. Compile your stop loss as a dll, save it in the /plugins subdirectory, and call it whenever you need it. See Appendix A.

Will either of these work?

Thanks,
Howard

Howard,

Welcome back.
Good to see you posting again.
 
Top