PureBytes Links
Trading Reference Links
|
Okay, I stripped away a ton of stuff from the previous exploration
code. Run it as is against a watchlist or small group of stocks.
Change the parameters from Yes to No to see how the results change.
Then start adding your logic (only after you get my scan to work).
C1 is the 1st days candle logic is to be assigned, likewise for C2 and
C3. Right now I have them all "or"ed together so you can see which
candles give you results.
Here it is:
// My Basic Candle Stick Exploration I - 12-16-07
// by MarketMonk777 a.k.a. RedEyes
//
// Purpose of this code is look for various conditions/patterns or
combinations of conditions/patterns
// The code is a base from which to add, delete, or modify these
conditions or patterns to look for
//
//
//
// ---------------- Initialization Of Parameters
---------------------------------------
//
PR = 0; // sometimes parameters need to be initialized.
// -------- Parameter Conditions and Variables for Exploration
--------------------------------
WLF = ParamToggle ( "Add Results to a Watchlist?", "No|Yes") ; //
Watch List Flag: select whether to add results to watchlist or not
WLN = Param("Set Watchlist Number", 30, 2, 60,1); // sets the
watchlist number, but reserves the first 2 and last 4 watchlists
PRF = ParamToggle("Check for Price in range?", "No|Yes"); // Price
Range Flag
HCV = Param("High close value ", 100, 5, 300, 0.5);
LCV = Param("Low close value " , 10, 1, 10, 0.25);
MVF = ParamToggle("Check for Min Volume?", "No|Yes"); // Minimum
Volume Flag: check for minimum volume?
PAV = Param("Period for Avg Vol " , 50, 10, 240, 1);
MAV = Param("Stock minimum Avg Vol " , 250000, 50000, 1000000, 5000);
C1 = 1; // Logic to find Candle 1 (replace "1" with
your logic)
C2 = 1; // Logic to find Candle 2
C3 = 1; // Logic to find Candle 3
// -------------- Test for conditions
----------------------------------------
PR = (Close >= LCV AND Close <= HCV); // Price of stock in range
VR = (MA( Volume, PAV ) > MAV); // Volume of stock in range
ATR5 = ATR(5); // Average True Range of stock over last 5 days
// ------------ Buy or Exploration Trigger Conditions Met?
------------------------------------------
My_Conditions = IIf(PRF,PR,1) AND IIf(MVF,VR,1) AND ( C1 OR C2 OR C3
); // This will catch all candles individually
Filter = My_Conditions;
Buy = Filter;
// ------------ Add Symbols to Watchlist?
------------------------------------------
Add = IIf( WLF==1, Filter , 0 ) ;
if( LastValue( Add ) )
{ CategoryAddSymbol( "", categoryWatchlist, WLN ); }
// -------------- Organize the exploration results
------------------------------------
AddColumn(C, "Close", 2.2, colorDarkGreen, colorLightGrey, 50);
AddColumn(V, "Volume",8.0, colorYellow, colorDarkGreen, 65);
// Volume Info
AddColumn(Ref(MA(V,PAV),-1), "Vol " + WriteVal(PAV, 2.0)+ " dma", 8.0,
colorWhite, colorBlue, 65);
AddColumn( ((V/Ref(MA(V,PAV),-1)*100)-100),"V % Inc " ,5.0,
colorLightYellow, colorDarkGrey, 55);
AddTextColumn(WriteIf(PR, "Yes", " "), "Price?", 50);
AddTextColumn(WriteIf(VR, "Yes", " "), "Min Vol?", 50);
AddTextColumn(WriteIf(C1, "Yes", " "), "Candle 1", 50);
AddTextColumn(WriteIf(C2, "Yes", " "), "Candle 2", 50);
AddTextColumn(WriteIf(C3, "Yes", " "), "Candle 2", 50);
--- In amibroker@xxxxxxxxxxxxxxx, "marketmonk777" <RedEyes777@xxx> wrote:
>
> Hi,
>
> When you say it didn't work, what do you mean? The code gave errors?
> You ran the exploration and got no results? You got results but
> those candle patterns were not what you were hoping for?
>
> What is your logic for the 1st candle?
> What is your logic for the 2nd candle?
> What is your logic for the 3rd candle?
>
> All I see is that you are using OHLC values and am not looking at the
> body length. But that can be added latter.
>
> How did my scan work? I know it wasn't anything to do with searching
> for candles but it can be used to lay the foundation down so you can
> build your search and look at each condition.
>
> Work with me here by providing the logic for each candle. I will
> modify my exploration scan (stripping out stuff you don't need) so you
> can see the power of the method I am trying to teach you.
>
> Dave
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "kiss4loverus" <kiss4loverus@> wrote:
> >
> > Hi,
> >
> > Thanks Dave for your fast response but i try like you said ( need to
> > use additional brackets) but it didn't worked.
> > I am still confused. Can you give me more details because i am newbie
> > in using program AFL in amibroker
> >
> > I just want to scan candle stick like morning star and evening star
> > etc. Don't need to back test, it's difficult for me
> >
> > May be others can help me
> >
> > Thanks for all your attention
> >
> > best regards
> > me
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "marketmonk777" <RedEyes777@> wrote:
> > >
> > > Hi,
> > >
> > > Without going into your code I suspect that you might need to use
> > > additional brackets "(" and ")" to group the conditions together.
> > >
> > > There are many types of Morning Star candles as per
> > > http://www.hotcandlestick.com/candles.htm
> > >
> > > Scroll down to bullish section and you will see Bullish Abandoned
> > > Baby, Bullish Morning Doji Star, and Bullish Morning Star.
> > >
> > > If it is the Bullish Morning Star that you are trying to scan
for the
> > > definition (per this site) is:
> > > 1. 1st day is a long black day.
> > > 2. 2nd day gaps below the 1st day's close.
> > > 3. 3rd day is a long white day.
> > > So creating a set of logic for each of these 3 conditions and then
> use
> > > Buy = Condition 1 AND Condition 2 AND Condition 3 may make it easier
> > > for you to debug and test your code.
> > >
> > > Here is a exploration that I use for a basis of testing. Run
the code
> > > and then look at the parameter options and the output results. This
> > > could give you the basis for testing the 3 conditions above like I
> > > have for a Volume Spike.
> > >
> > > Good Luck,
> > >
> > > Dave
> > >
> > > // My Basic Stock Exploration III - 10-8-06 attempting to add
> > > Stochastics Scan(s)
> > > // by MarketMonk777 a.k.a. RedEyes
> > > // Original code provided by Patrick Hargus - NW Trader
> > > // Additional help from Graham, Terry, Duke, Thomas, and a few
others
> > > (thanks guys!)
> > > //
> > > // Purpose of this code is look for various conditions/patterns or
> > > combinations of conditions/patterns
> > > // The code is a base from which to add, delete, or modify these
> > > conditions or patterns to look for
> > > // A neat feature provided by AB over that of TC2005 is that one can
> > > specify a date range in the past in which to run an exploration
> > > // I can run an exploration for dates well in the past and visually
> > > see how those signals performed (visually as well as via the output)
> > > //
> > >
> > >
> > > // ---------------- Initialization Of Parameters
> > > ---------------------------------------
> > > // Not sure if I need this section
> > > PR = 0;
> > > VR = 0;
> > > VS = 0;
> > >
> > >
> > > // -------- Parameter Conditions and Variables for Exploration
> > > --------------------------------
> > > WLF = ParamToggle ( "Add Results to a Watchlist?", "No|Yes") ; //
> > > select whether to add results to watchlist or not
> > > WLN = Param("Set Watchlist Number", 30, 2, 60,1); // sets the
> > > watchlist number, but reserves the first 2 and last 4 watchlists
> > > PRF = ParamToggle("Check for Price in range?", "No|Yes");
> > > HCV = Param("High close value ", 100, 5, 300, 0.5);
> > > LCV = Param("Low close value " , 10, 1, 10, 0.25);
> > > MVF = ParamToggle("Check for Min Volume?", "No|Yes");
> > > PAV = Param("Period for Avg Vol " , 50, 10, 240, 1);
> > > MAV = Param("Stock minimum Avg Vol " , 250000, 50000, 1000000,
5000);
> > > VSF = ParamToggle("Check for Volume Spike", "No|Yes");
> > > VSP = Param("Volume Spike Percentage" , 50, 10, 100000, 10);
> > > SSF = ParamToggle("Check for Stoch Signal", "No|Yes");
> > >
> > >
> > > // -------------- Test for conditions
> > > ----------------------------------------
> > > PR = (Close >= LCV AND Close <= HCV);
> > > VR = (MA( Volume, PAV ) > MAV);
> > > VS = ((Volume/Ref(MA(Volume,PAV),-1)*100)-100) > VSP;
> > > ATR5 = ATR(5);
> > > SD = StochD(14,3,3); // modified from 5,3 to 14,3
> > > SD25 = SD < 30;
> > > SK = StochK(14,3); // modified from 5,3 to 14,3
> > > SS = Cross(SK,SD);
> > > HHVol = Volume > Ref(Highest(Volume),-1);
> > >
> > > // ------------ Buy or Exploration Trigger Conditions Met?
> > > ------------------------------------------
> > > My_Conditions = IIf(PRF,PR,1) AND IIf(MVF,VR,1) AND
IIf(VSF,VS,1) AND
> > > IIf(SSF,SD25,1) AND IIf(SSF,SD25,1);
> > > // modified 7-19-07 from SSF,SS to SSF,SD25
> > > Filter = My_Conditions;
> > > Buy = Filter;
> > >
> > > // ------------ Add Symbols to Watchlist?
> > > ------------------------------------------
> > > Add = IIf( WLF==1, Filter , 0 ) ;
> > > if( LastValue( Add ) )
> > > { CategoryAddSymbol( "", categoryWatchlist, WLN ); }
> > >
> > >
> > > // -------------- Organize the exploration results
> > > ------------------------------------
> > > AddColumn(C, "Close", 2.2, colorDarkGreen, colorLightGrey);
> > > AddColumn(V, "Volume",8.0, colorYellow, colorDarkGreen);
> > > // Volume Info
> > > AddColumn(Ref(MA(V,PAV),-1), "Vol " + WriteVal(PAV, 2.0)+ "
dma", 8.0,
> > > colorWhite, colorBlue);
> > > AddColumn( ((V/Ref(MA(V,PAV),-1)*100)-100),"V % Inc " ,5.0,
> > > colorLightYellow, colorDarkGrey);
> > > AddTextColumn(WriteIf(PR, "Yes", " "), "Price?");
> > > AddTextColumn(WriteIf(VR, "Yes", " "), "Min Vol?");
> > > AddTextColumn(WriteIf(VS, "Yes", " "), "Vol % Inc?");
> > > AddTextColumn(WriteIf(HHVol, "Yes", " "), "HH Vol?");
> > > AddColumn(SD, "SD", 2.2, colorDarkGreen, colorLightGrey);
> > > AddColumn(SK, "SK", 2.2, colorDarkGreen, colorLightGrey);
> > > AddTextColumn(WriteIf(SD25, "Yes", " "), "SD<25");
> > > AddColumn(ATR(5), "ATR5",5.2, colorYellow, colorDarkGreen);
> > > AddColumn(LastValue(C), "Last Close", 2.2, colorDarkGreen,
> > > colorLightGrey);
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "kiss4loverus" <kiss4loverus@>
> wrote:
> > > >
> > > > I want to make MORNING STAR in Amibroker Power Scan
> > > > and i make program in power scan :
> > > >
> > > > Buy = Ref( Close, -1 ) > Ref( Open, -1 )
> > > > AND Ref( Open, -3 ) > Ref( Close, -3 )
> > > > AND Ref( Close, -4 ) > Ref( Close, -3 )
> > > > AND Ref( Open, -1 ) > Ref( Close, -2 )
> > > > OR Ref( Open, -1 ) == Ref( Close, -2 )
> > > > AND Ref( Volume, -1 ) > Ref( Volume, -2 )
> > > > AND Ref( Open, -2 ) == Ref( Close, -2 )
> > > > AND Ref( Close, -1 ) > Ref( Close, -3 )
> > > > AND Ref( Close, -3 ) > Ref( Close, -2 )
> > > > OR Ref( Close, -3 ) == Ref( Close, -2 );
> > > >
> > > > but after i scan i got wrong result
> > > > I don't know what's my mistake
> > > >
> > > > Anybody can help me?
> > > >
> > > > note:
> > > > you can see picture in :
> > > >
> >
http://finance.ph.groups.yahoo.com/group/amibroker/photos/view/df6b?b=1
> > > >
> > >
> >
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|