Amibroker scan clubbing stocks together

#1
Hi,
When I scan stocks for buy/sell as per my strategy the amibroker lists stocks here and there, is it possible to club stocks at one place. Please find below you can find that ACC ZEEL, YESBANK are not at one place/list. Thanks

tj12.jpg
 

pannet1

Well-Known Member
#4
hi,

i am trying to scan for a 5Min bar that open below (or above) and closed above (or below) ... with the below code.
EDIT: BEARISH SIGNAL LOGIC IS IN (BRACKETS) ABOVE

Code:
//------------------------------------------------------
//
//------------------------------------------------------

_SECTION_BEGIN("WMA65");
//Moving Average (Short, Mid & Long Term)
MA_bull = WMA(Avg, 65);
MA_bear = WMA(Avg, 65);


BuLLStatus = WriteIf(Close>MA_bull AND Open<MA_bull,"Bullish","N/A");
BullColor = IIf(Close<MA_bull AND Open<MA_bull,colorGreen,colorGrey40);

BearStatus = WriteIf(Close<MA_bear AND Open>MA_bear,"Bearish","N/A");
BearColor = IIf(Close<MA_bear AND Open>MA_bear,colorRed,colorGrey40);

Filter = 1;
AddColumn(C,"Close",1,IIf(C>Ref(C,-1),colorGreen,colorRed));
AddColumn(V,"Volume",1,IIf(V>Ref(V,-1),colorGreen,colorRed));

AddTextColumn(BullStatus,"BULL cross",1,colorWhite,BullColor);
AddTextColumn(BearStatus,"BEAR cross",1,colorWhite,BearColor);
_SECTION_END();
I am getting lot of greycolor and "N/A", which is not the expected behavior. can anyone please guide me to fix this.


1528718125922.png
 
Last edited:

travi

Well-Known Member
#5
hi,

i am trying to scan for a 5Min bar that open below (or above) and closed above (or below) ... with the below code.
EDIT: BEARISH SIGNAL LOGIC IS IN (BRACKETS) ABOVE

I am getting lot of greycolor and "N/A", which is not the expected behavior. can anyone please guide me to fix this.
Explain what you want to achieve properly, its very vague. Use some charts as well.

and if MA_bull and MA_bear are the same, why have you declared same thing twice ?
 

pannet1

Well-Known Member
#6
Explain what you want to achieve properly, its very vague. Use some charts as well.
If a candle opens below 65WMA and closes above 65WMA, i want it to come in the scan result, in a column named Bull Cross with value Bullish (color green). at the same time, column named Bear Cross will have value N/A with grey color. Vice versa for Bear Cross ...

The decorations are not mandatory, i want to know immediately if a candle crosses the WMA. Thats all.



1528732264393.png



and if MA_bull and MA_bear are the same, why have you declared same thing twice ?

That's right. I am new to Ami, so forgot to change it ... was working late night yesterday.
 

travi

Well-Known Member
#7
If a candle opens below 65WMA and closes above 65WMA, i want it to come in the scan result, in a column named Bull Cross with value Bullish (color green). at the same time, column named Bear Cross will have value N/A with grey color. Vice versa for Bear Cross ...

The decorations are not mandatory, i want to know immediately if a candle crosses the WMA. Thats all.
...
That's right. I am new to Ami, so forgot to change it ... was working late night yesterday.
Can you post a chart of 5m AJANTPHARM with the same WMA and corresponding output of analysis from the exploration ?

I suspect the settings are not correct, for eg. you've used "All Quotes" instead of something like 1 recent bar or intraday range etc.
Another setting "Periodicity" also may be default Daily instead of 5m.
post screenshot of settings window as well for the Analysis.
 

pannet1

Well-Known Member
#8
Can you post a chart of 5m AJANTPHARM with the same WMA and corresponding output of analysis from the exploration ?

I suspect the settings are not correct, for eg. you've used "All Quotes" instead of something like 1 recent bar or intraday range etc.
Another setting "Periodicity" also may be default Daily instead of 5m.
post screenshot of settings window as well for the Analysis.
i made some changes to the code and there are only two more things i need now.

Code:
_SECTION_BEGIN("Weighted65");
// Weighted Moving Average on Average price
weightedMA = WMA(Avg, 65);

TrendStatus = WriteIf( Close>weightedMA AND Open<weightedMA,"Bullish", WriteIf(Close<weightedMA AND Open>weightedMA, "Bearish", "Neutral" ) );
TrendColor = IIf(Close>weightedMA AND Open<weightedMA,colorGreen, IIf(Close<weightedMA AND Open>weightedMA, colorRed, colorGrey40)  );

Filter = 1;

// AddColumn(V,"Volume",1,IIf(V>Ref(V,-1),colorGreen,colorRed));
AddColumn(O,"Open",1,IIf(O>Ref(O,-1),colorGreen,colorRed));
AddColumn(weightedMA ,"WMA", 1, colorBlack);
AddColumn(C,"Close",1,IIf(C>Ref(C,-1),colorGreen,colorRed));
AddTextColumn(TrendStatus,"Trend",1.2,colorWhite,TrendColor);
_SECTION_END();

the code correctly picked up the cross overs at 9:30 and 9:35 and 12:15 (others not pictured)

1528754946970.png


the chart

1528755033809.png



the two things required are:-

1) The trend column is supposed to print "bullish" or "bearish". the bar crossing is correctly color coded but the text is always "neutral".

Code:
TrendStatus = WriteIf( Close>weightedMA AND Open<weightedMA,"Bullish", WriteIf(Close<weightedMA AND Open>weightedMA, "Bearish", "Neutral" ) );
2) i want the scan only to capture the crossing (and leave out all the neutral ones). now every bar is scanned and columns printed ... this is not desired.
 
Last edited:
#9
Filter = 1;
will give you all the bars,


instead if you want only the bars that cross the MA can try

Filter = (Close>weightedMA AND Open<weightedMA) or (Close<weightedMA AND Open>weightedMA);


Happy :)
 

pannet1

Well-Known Member
#10
Filter = 1;
will give you all the bars,


instead if you want only the bars that cross the MA can try

Filter = (Close>weightedMA AND Open<weightedMA) or (Close<weightedMA AND Open>weightedMA);


Happy :)
Hello Sardar,

Thank you.

How was your visit to Auroville?

Any idea why this nested conditional write is always returning .. "Neutral"?

Code:
TrendStatus = WriteIf( Close>weightedMA AND Open<weightedMA,"Bullish", WriteIf(Close<weightedMA AND Open>weightedMA, "Bearish", "Neutral" ) );
1528774135264.png
 
Last edited: