Australian (ASX) Stock Market Forum

Amibroker FAQ

Thomas created this simple loop awhile ago. Hope it helps. As I posted in the P.M., I had a go at Time stamping the buy bar but couldn't get a native function to plot the time. Note -- I am not a coder. ;)

Code:
Buy = Cross(RSI(), 50);
Sell = Cross(50, RSI());


Distance = 1.5 * ATR(100); 

for(i = 0; i < BarCount; i++) 
{ 
if(Buy[i]) PlotText("" + Name(), i, L[i] -Distance[i], colorBlack); 
}  

PlotShapes(IIf(Buy, shapeSmallCircle, 0), colorBrightGreen, 0, L, -15);

Untitled.png
 
Thomas created this simple loop awhile ago. Hope it helps. As I posted in the P.M., I had a go at Time stamping the buy bar but couldn't get a native function to plot the time. Note -- I am not a coder. ;)

Code:
Buy = Cross(RSI(), 50);
Sell = Cross(50, RSI());


Distance = 1.5 * ATR(100); 

for(i = 0; i < BarCount; i++) 
{ 
if(Buy[i]) PlotText("" + Name(), i, L[i] -Distance[i], colorBlack); 
}  

PlotShapes(IIf(Buy, shapeSmallCircle, 0), colorBrightGreen, 0, L, -15);

View attachment 66720

Hi wysiwyg,thanks..
it's bit different than this code, code that you mentioned is kind of similiar to manual.
Kindly see pic.
WdGg5xC.png

0fhlzoe.png

Code:
SetOption("NoDefaultColumns", True );

Plot(C, "",colorLightGrey, styleCandle) //For seeing chart

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime();
 filter = 0;

for(i=1; i<=10; i++) {

   TimeframeSet(i * in1Minute);

   up= (ABS(O - C ) <= ((H - L ) * 0.1))

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t";


   x= StrFormat("%02g-min", i);
[COLOR="#008000"]   bar = bar+ WriteIf(up,  x, "\t");
[/COLOR]

        addRow(bar );

  TimeframeRestore();
m1 = TimeFrameExpand(up,in1Minute);

}

f[COLOR="#FF0000"][COLOR="#008000"]or(b=0; b<BarCount;, b++)
{
 if(up[b] == True) PlotText(":",b + WriteVal(up),colorAqua, bkcolor =colorDefault);
}

PlotShapes(up*shapeSmallCircle,colorGreen,0,Low,-20);[/COLOR][/COLOR]

Kindly try to change in this.

regards
 
Hi wysiwyg,thanks..
it's bit different than this code, code that you mentioned is kind of similiar to manual.
Kindly see pic.
View attachment 66724

View attachment 66725

Code:
SetOption("NoDefaultColumns", True );

Plot(C, "",colorLightGrey, styleCandle) //For seeing chart

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime();
 filter = 0;

for(i=1; i<=10; i++) {

   TimeframeSet(i * in1Minute);

   up= (ABS(O - C ) <= ((H - L ) * 0.1))

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t";


   x= StrFormat("%02g-min", i);
[COLOR="#008000"]   bar = bar+ WriteIf(up,  x, "\t");
[/COLOR]

        addRow(bar );

  TimeframeRestore();
m1 = TimeFrameExpand(up,in1Minute);

}

f[COLOR="#FF0000"][COLOR="#008000"]or(b=0; b<BarCount;, b++)
{
 if(up[b] == True) PlotText(":",b + WriteVal(up),colorAqua, bkcolor =colorDefault);
}

PlotShapes(up*shapeSmallCircle,colorGreen,0,Low,-20);[/COLOR][/COLOR]

Kindly try to change in this.

regards

I got one , which is showing just name but not passing array, KIndly try it .

Code:
_SECTION_BEGIN("exprimenting");
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0;

for(i=1; i<=10; i++) { 

   TimeframeSet(i * in1Minute);
      O1 = Ref(O,-1);  C1 = Ref(C,-1); 
   O2 = Ref(O,-2);  C2 = Ref(C,-2); 
   up= C1>O1; 

   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);

}
Distance = 1.5 * ATR(100); 

for(b=0; b<BarCount;, b++)
{
 if(up[b] == True)PlotText(":1" + up[b], b, L[b] -Distance[b], colorAqua);
}

PlotShapes(up[i]*shapeSmallCircle,colorGreen,0,Low,-20);

Plot(C, "",colorLightGrey, styleCandle); //For seeing chart
_SECTION_END();

Kindly try it, i know that concept is not used before..bit new.

regards
 
Hi guys, if anyone got any free time could you have a look and check my code below? cheers.

My objectives in order of each code as follow:

1) OS, looking for close below 5 days ago. OB, looking for close above 5 days ago.

2)Maximum bullish price swing, trying to calculate the difference between the high and the open of last 4 days then average the number. Maximum bearish price swing, trying to calculate the difference between the close and the low of last 4 days then average the number.

3)Long/short signal. For long, first part calculate difference between high and open for end of today and second part the value on the first part is equal or greater than the bull average time 1.75 as calculated above. For short same process, difference between close and low for end of day.

4)any way to improve filter?

5)disregard //test and column 3 to 6, used for testing.

//Price swing

//Locate oversold and overbought in last 5 days
OS = C < Ref(C, -5);
OB = C > Ref(C, -5);

//Maximum bullish price swing
D1 = Ref(H, -1) - Ref(O, -1);
D2 = Ref(H, -2) - Ref(O, -2);
D3 = Ref(H, -3) - Ref(O, -3);
D4 = Ref(H, -4) - Ref(O, -4);

BullAverage = (D1 + D2 + D3 + D4)/4;

//Maximum bearish price swing
D1 = Ref(C, -1) - Ref(L, -1);
D2 = Ref(C, -2) - Ref(L, -2);
D3 = Ref(C, -3) - Ref(L, -3);
D4 = Ref(C, -4) - Ref(L, -4);

BearAverage = (D1 + D2 + D3 + D4)/4;

//Long/short signal
Long = (Ref(H, 0) - Ref(O, 0)) >= (BullAverage * 1.75);

Short = (Ref(C, 0) - Ref(L, 0)) >= (BearAverage * 1.75);

// Price and Volume
PVFilter = Ref(MA(V,50),-1)>100000;

//test
LS = Ref(H, 0) - Ref(O, 0);

SS = Ref(C, 0) - Ref(L, 0);

// Columns
NumColumns = 7;

Column0 = FullName();
Column0Name = "Ticker name";

Column1 = IIf(PVFilter AND OS AND Long, 1, 0);
Column1Name = "Buy Signal";

Column2 = IIf(PVFilter AND OB AND Short, 1, 0);
Column2Name = "Sell Signal";

Column3 = BullAverage;
Column3Name = "MaxBullSwing";

Column4 = BearAverage;
Column4Name = "MaxBearSwing";

Column5 = LS;
Column5Name = "long";

Column6 = SS;
Column6Name = "short";


AddTextColumn( SectorID(1), "Sector" );

AddTextColumn( MarketID(1), "Market" );

// Filter
Filter = Column1 OR Column2;
 
How do i get the red hollow arrow out? anybody?
That is a short signal arrow built in to Amibroker. To turn signal arrows off go to parameters window - axes and grid - show trading arrows yes and click to no.


For the present bar, this (Ref(H, 0) - Ref(O, 0)) = this (H - L)
 
That is a short signal arrow built in to Amibroker. To turn signal arrows off go to parameters window - axes and grid - show trading arrows yes and click to no.


For the present bar, this (Ref(H, 0) - Ref(O, 0)) = this (H - L)

Ah i see cheers wysi. I actually need the open, so i can do this as well right (H - O)?
 
Hi,
I want help in this code. I got it from one member. he sent this question i also tried it .
Code:
for(i=1; i<=5; i++) {
TimeframeSet(i * in1Minute);
up15= C > O; 
TimeframeRestore();
}


for(i=10; i<=15; i++) {    
TimeframeSet(i * (2*in5Minute)); 
up1015= C > O;
TimeframeRestore();
}


expandmode = expandPoint;
up15= TimeFrameExpand(up15, in1minute, expandmode);
up1015 = TimeFrameExpand(up1015, (10*in1Minute), expandmode);

Plot( C, "Price", colorYellow, styleCandle ); 
PlotShapes( IIF( up15 AND up1015, shapeUpArrow , shapeNone ), colorAqua );


QUESTION:
if there is bar PATTERN BETWEEN 1min. to 5min.
if there is bar PATTERN BETWEEN 10min. to 15min.
if BOTH CONDITION IS RIGHT..
putting arrow on 1 min. timeframe.



PROBLEM:
which expandmode function should be used ?

1. Is this code right?
2. In this problem , arrow isn't stable, IT'S MOVING with price.

Kindly give your opinion..

regards
 
Hi,
I want help in this code. I got it from one member. he sent this question i also tried it .
Code:
for(i=1; i<=5; i++) {
TimeframeSet(i * in1Minute);
up15= C > O; 
TimeframeRestore();
}


for(i=10; i<=15; i++) {    
TimeframeSet(i * (2*in5Minute)); 
up1015= C > O;
TimeframeRestore();
}


expandmode = expandPoint;
up15= TimeFrameExpand(up15, in1minute, expandmode);
up1015 = TimeFrameExpand(up1015, (10*in1Minute), expandmode);

Plot( C, "Price", colorYellow, styleCandle ); 
PlotShapes( IIF( up15 AND up1015, shapeUpArrow , shapeNone ), colorAqua );


QUESTION:
if there is bar PATTERN BETWEEN 1min. to 5min.
if there is bar PATTERN BETWEEN 10min. to 15min.
if BOTH CONDITION IS RIGHT..
putting arrow on 1 min. timeframe.



PROBLEM:
which expandmode function should be used ?

1. Is this code right?
2. In this problem , arrow isn't stable, IT'S MOVING with price.

Kindly give your opinion..

regards

Hi, In gif pic( below link) ,you can see Arrow is not aligned with price (candlestick)? as i mentioned in 2, Kindly help.
http://imgur.com/gJ1tP69


regards
 
fxtraders

Your code too advanced for me. I only have EOD data. But I hope you maybe get help from complete post here:

Hi,
I do aware about all sources on internet about this, but couldn't find decent solution.
If you do add something in it,kindly let us know.
No , it's not that much difficult code.

regards
mtftraders
 
Hi everyone,

Sorry for such a basic question, but I have read the Amibroker manual, and searched pages and pages on Google and can't find the answer.

Basically, I want to change the parameters on the Bollinger Band to a 100 day moving average with the upper band set to 3 standard deviations and the lower band set at 1 standard deviation.

Below is the code for the standard Amibroker settings, what exactly do I need to change?

P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );

Thanks for any help,

Steve
 
Hi everyone,

Sorry for such a basic question, but I have read the Amibroker manual, and searched pages and pages on Google and can't find the answer.

Basically, I want to change the parameters on the Bollinger Band to a 100 day moving average with the upper band set to 3 standard deviations and the lower band set at 1 standard deviation.

Below is the code for the standard Amibroker settings, what exactly do I need to change?

P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );

Thanks for any help,

Steve

This might help, just watched it last night.:)

 
Last edited by a moderator:
a = BBandTop(C,100,3);
b = BBandBot(C,100,3);
Plot(a,"top",colorBlack);
Plot(b,"bott",colorBlack);

[edited]

Thanks Gringotts, where exactly do I place the above? Do I just put it in anywhere among the current code, so,

P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
a = BBandTop(C,100,3);
b = BBandBot(C,100,3);
Plot(a,"top",colorBlack);
Plot(b,"bott",colorBlack);

?
 
This might help, just watched it last night.:)



Thanks CanOz - I recently watched this and it was extremely useful in creating a basic system, just wasn't sure how that code would be used in the actual Bollinger indicator. When I ran a back test and went through to a chart of a stock that matched the screening, it would still have the default bollinger band settings so I couldn't see exactly where it touched the upper band if it was 3 std dev etc.
 
Last edited by a moderator:
Top