PureBytes Links
Trading Reference Links
|
Hello Paul,
Eventually, if you keep going, you will develop your own trading
style. For that reason I try to avoid imposing my
biases on other traders but as a general rule of thumb, simpler is
better.
Later when you are designing systems you will find that a small
number of trading rules in a system has advantages;
it avoids overfitting and returns a higher frequency of signals.
Yoy might be interested in CANSLIM.
If you search the web you will find the homesite for it.
Some of the traders here have an interest in it.
I think some of Don Lindbergs posts discuss explorations etc that
are related to that type of approach.
A couple of comments on your code that might help.
Assigning a variable is generally a pre-cursor to using it in
another formula.
If a piece of code is complicated it helps to understand the process
flow by assigning it to a variable and then in later code you only
have to refer to the variable as a form of short-hand for the
original code.
Also if you are going to use the code in several formulas it saves
having to rewrite it e.g.
M = MA(C,15);
R = IIf(ROC(M,1)> 0,1,0);
Plot(R,"ROCDirection",1,1);
Incidentally, if you copy/save the above and insert it in a chart
pane it will indicate when the chosen MA is going up or down.
In your code example you don't need to assign your statements to a
variable as they are all true or false statements.
The code will simply return true (1) if they are all true and false
(0) if any one of them is false.
As an example copy/save this code and insert it into a chart pane.
Progressively comment out and uncomment each line and you can see
that the plot is always 0 or 1, depending on the truth of your
statements.
Plot(C>0 ,"Test",1,1);
//Plot(C>0 AND C>O,"Test",1,1);
//Plot(C>0 AND C>O AND C > MA(C,15),"Test",1,1);
The true/false output is very useful in more advanced formulas e.g.
when the ROC of an MA changes from 0 to 1 the MA is at a turning
point or pivot point.
BrianB2.
--- In amibroker@xxxxxxxxxxxxxxx, "paulradge" <paulradge@xxx> wrote:
>
> Hi all,
> i know i'm at beginner levels but i just wanted to give my
feed back to those that helped me,,,and have to admitt i'm still
learning the code and taking bits from here n there without fully
understanding it all,, but i've got my 3 day swing exploration
working at this stage and it kinda feels good :) ,,,
>
> i've now subscribed to premium data eod for the asx and usa stocks
i explore one of the cfd watch lists ,i've also noticed i can
explore with n=1 function or a 5 day range which returns more scans
with a little noise.
>
> there's probably easier ways of doing it but here it is,,any
comments welcome.
> cheers
> Paul
> Filter = C > 1 AND C < 20 //looking for bang for buck value
>
> AND RecentHi3Is20=Ref(H,-3)==HHV(H,20) //looking for 3 day hi to
be highest in 20days
>
> AND recenthi= Ref(H,-1)< Ref(H,-2) //looks for 3 lower highs
>
> AND RecentHi=Ref(H,0) < Ref(H,-1)
>
> AND MAproperOrder=IIf(MA(C,18)>MA(C,40),1,0) //trend definer
>
> AND MAproperOrder=IIf(MA(C,40)>MA(C,41),1,0) //attempt to ensure
40ma pointing up
>
> AND recentLow=Ref(L,0) < Ref(L,-1) //trying to ensure a new high
creates an isolation
>
> AND recentlow=Ref(L,0) < MA(C,18); //trying to ensure some
reversion to the mean
>
> AddColumn (C,"close"); //needed a column for exploration
>
> AddColumn (V,"Volume"); //add on bit of fun.
>
>
>
>
>
>
>
>
>
>
>
> Paul,
>
>
>
> The failed to initialize a variable error.....In most cases it
seems that Amibroker requires that you give the moving averages a
variable name or use a logical iif statement to assign a value from
a comparison.
>
>
>
> Try this for the most straightforward way I can think of.
>
>
>
> T=MA(C,20);
>
> F=MA(C,40);
>
> Filter=T>F;
>
>
>
> This should do an exploration for that one factor on whatever
list you have selected or filtered on the left side of the automatic
analysis window.
>
>
>
> Filter statement must come after defining MA proper order. Code
isn't smart enough to look forward to see that you will define
MAproperOrder in a later statement.
>
>
>
> Filter= MAproperOrder >0;
>
> MAproperOrder = iif(MA(C,20)>MA(C,40),1,0) ; ...... this is
the logical iif statement to get MAproperOrder defined.
>
>
>
> So you can try it this way. You have to use an iif (2 i's in
iif) statement in order to combine the logic the way you wanted to
and get your variable defined with a value. You were writing a
logical statement, so it requires the iif statement, I believe. The
iif statements are the same as Excel formula format.
>
>
>
> MAproperOrder = iif(MA(C,20)>MA(C,40),1,0) ;
>
> Filter= MAproperOrder >0;
>
>
>
> Hope this helps - it's hard jump starting any new programming
language, but I can assure you that Amibroker is efficient with
their code and it's rational. And it's compact compared to some of
the other systems. I'm working to think like it thinks.... it's
generally more logical than I am... Hard on my brain some days. I'm
a rookie as well as you. Takes a while and what I think will work,
won't necessarily. And it seems that your code should work, but
this probably will. The pro's here can make this stuff work with a
lot of combined expressions, but I stick with one step at a time.
>
>
>
>
>
> Mike
>
>
>
>
>
>
> -------------------------------------------------------------------
-----------
>
> From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of paulradge
> Sent: Sunday, October 15, 2006 1:28 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] mentor wanted
>
>
>
> Hi Robert,
>
> thank you for your input and my apologies for my
post being so confusing,,
>
>
>
> i'm not going to pursue assembling such a basic swing filter any
longer but my sincere thanks for your time,
>
>
>
> all the best with your trading and interests
>
> regards
>
> Paul
>
>
>
>
>
> It is hard for me to understand your question but if you want
a signal that the high 3 days ago was the highest in the last 20
days, you might think about something like this:
>
>
>
> RecentHi3IsHi20=ref(H,-3)==hhv(H,20);
>
>
>
> Robert
>
> paulradge <paulradge@xxx> wrote:
>
> I've started reading the tutorials but i'm not finding what
i want to see,,,
>
> i'd like to put together a simple swing scan/explorer based
on Oliver Velez
> swing trading tactics,,,
>
> a 20ma above a 40ma ,,the high of 3-5 days ago the highest
high in 20 days
> ,,,the 3-5 days of down to have lower highs looking for a
new higher high
> for the buy with the stop under the last isolation
low /pivotpoint
>
> with ezyanalyser i can have all but 1 of those indicators
done in
> seconds,,,the 1 i can't have is the 20ma above the 40
ma,,for some reason
> ezyanalyser looks at the ma of 20 days ago,,,and hence why i
wanted
> amibroker,,,with the bonus of everything else amibroker
does,,,,not to
> mention the company of some mind boggling posts from this
user group.
>
> alas learning this language is more complex than studying
Bradley Cowan's
> 4th dimensional market geometry,,
>
> hunting around through other filters in the library and
reading the
> tutorials,,,which are great but i'm not interestedin buying
a ma cross over
> or macd,,,nor in backtesting at this stage,,,but i do need
your help or
> someone to mentor me through this swing scan/explorer
>
> this is where i'm at ,,i've tried pinching this from a swing
scan in the
> library but changed the ma values to what i want,,so i can
atleast get part
> of this swing filter together,,
>
> MAProperOrder = (MA(c,20) > MA(c,40));
> post this i get a "variable" error ,,,after some reading and
looking through
> other files i now have
> Filter = MAProperOrder before the other line,,,that error
has now moved to
> error 29 ,,needs to be initialised,,,as i've mentioned in
another post on
> Gartleys ,,i've looked up error 29 and read the example but
fail to
> understand how that apply's to this situation also,,
>
> next i need to be able to set the high of 3 days ago to be
the highest in 20
> days,,,anytips on where abouts in the tutorial i can read up
on the language
> used set this up please,,,,
>
> regards
> Paul
>
>
>
>
> -------------------------------------------------------------------
---------
>
> All-new Yahoo! Mail - Fire up a more powerful email and get
things done faster.
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|