PureBytes Links
Trading Reference Links
|
There
were some errors in the coding, also not sure what you are actually trying to
use, eg the value of StochK is used as an entry price
I have
made some correctiosn to get it working, but results will need to be
defined
SetTradeDelays(<FONT
color=#ff00ff>0,0,<FONT
color=#ff00ff>0,0);<FONT
color=#ff0000>
BuyPrice = O;<FONT
color=#ff0000>
SellPrice = O;
StochUp = Cross<FONT
face="Courier New">( <FONT face="Courier New"
color=#0000ff>StochK(<FONT
face="Courier New" color=#ff00ff>14),
StochD<FONT
face="Courier New">(<FONT face="Courier New"
color=#ff00ff>14) <FONT
face="Courier New">);
StochDn = Cross<FONT
face="Courier New">( <FONT face="Courier New"
color=#0000ff>StochD(<FONT
face="Courier New" color=#ff00ff>14),
StochK<FONT
face="Courier New">(<FONT face="Courier New"
color=#ff00ff>14) <FONT
face="Courier New">);
//the next 2 give a value of the StochK ?
BuyStocVal = <FONT
face="Courier New" color=#0000ff>ValueWhen<FONT
face="Courier New">( StochU<FONT
face="Courier New">p, <FONT face="Courier New"
color=#0000ff>StochK(<FONT
face="Courier New" color=#ff00ff>14),
1 <FONT
face="Courier New">);
//SellStocVal<FONT
color=#008000> =<FONT
color=#008000> <FONT face="Courier New"
color=#008000>ValueWhen( <FONT
face="Courier New" color=#008000>StochDn,
StochK(14),<FONT
color=#008000> <FONT face="Courier New"
color=#008000>BarsSince(StochUp<FONT
face="Courier New" color=#008000>)) )<FONT
face="Courier New" color=#008000>;//what is the
Barssince meant to give, as it is does not work<FONT
face="Courier New">
SellStocVal = <FONT face="Courier New"
color=#0000ff>ValueWhen( StochDn,
StochK<FONT
face="Courier New">(<FONT face="Courier New"
color=#ff00ff>14), <FONT
color=#ff00ff>1 );
StocRise=SellStocVal-BuystocVal;
//Next 2 can be replaced with the buyprice and sellprice as above
//<FONT face="Courier New"
color=#008000>Entryprice=ValueWhen( <FONT
face="Courier New" color=#008000>StochUp<FONT
face="Courier New" color=#008000>, <FONT
face="Courier New" color=#008000>Ref(Open,0),
1);
//<FONT face="Courier New"
color=#008000>Exitprice=ValueWhen( <FONT
face="Courier New" color=#008000>StochDn,
Ref(Open,0),<FONT
color=#008000> <FONT face="Courier New"
color=#008000>BarsSince(StochUp<FONT
face="Courier New" color=#008000>) )<FONT
face="Courier New" color=#008000>;
Pricerise = <FONT
color=#ff0000>SellPrice-<FONT
color=#ff0000>BuyPrice;<FONT
color=#008000>//Exitprice-entryprice;<SPAN
class=163063323-17092003>?????????????????????????????????<FONT
face="Courier New">
percentrise = <FONT
face="Courier New">pricerise/<FONT
color=#ff0000>BuyPrice; <FONT
color=#008000>//pricerise/entryprice;<SPAN
class=163063323-17092003>//???????????????????????????????<FONT
face="Courier New" size=2>
//Filter=Buystocval AND
Sellstocval AND stocrise AND entryprice AND exitprice AND pricerise;<FONT
color=#008000> //as written these would need to have values of 0 or 1, but have
actual values
//use this
????????????????????????????????????????????<FONT
color=#ff0000 size=2>
Filter =<FONT color=#ff00ff
size=2>1;//gives scan
of all stocks
fiilter = StochUp OR StochDn;<FONT
color=#008000>//gives only the crossed signals stocks<SPAN
class=163063323-17092003>??????????????????????????????????
//simplifed addcolumn unless you are changing the default
values of colours etc.<SPAN
class=163063323-17092003>????????????????????????????????
addcolumn( <FONT face="Courier New"
color=#008000>StochK(14), <FONT
face="Courier New" color=#008000>"Buy Value",
1.2<FONT
color=#008000>)
//All of these addcolumns
are the same value
???????????????????????????????????????????????????????<FONT
face="Courier New" color=#0000ff size=2>
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Buy Value" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Sell Value" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Stoc Rise" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Buy price" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Sell price" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"Price rise" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>);
AddColumn(<FONT
face="Courier New" color=#0000ff size=2>StochK<FONT
face="Courier New" size=2>(<FONT face="Courier New" color=#ff00ff
size=2>14),<FONT
face="Courier New" color=#8b0000 size=2>"% change" ,
format=<FONT face="Courier New"
color=#ff00ff size=2>1.2<FONT face="Courier New"
size=2>,textcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault<FONT face="Courier New"
size=2>,bkgndcolor=<FONT face="Courier New" color=#ff0000
size=2>colorDefault);<FONT
face=Arial color=#000000 size=3>
<I
><SPAN
>
<I
><SPAN
>Cheers<SPAN
class=GramE>,<?xml:namespace prefix = st1 ns =
"urn:schemas-microsoft-com:office:smarttags" /><st1:PersonName
><B
><I
><SPAN
>Graham
<A
href=""><FONT
color=#008080>http://groups.msn.com/ASXShareTrading<?xml:namespace
prefix = o ns = "urn:schemas-microsoft-com:office:office"
/>
<A
href=""><FONT
color=#008080>http://groups.msn.com/FMSAustralia
<FONT
face=Tahoma size=2>-----Original Message-----From: mrdavis9
[mailto:mrdavis9@xxxxxxxxxx] Sent: Thursday, 18 September 2003 5:00
AMTo: amibrokeryahoogroupsSubject: [amibroker]
Exploration Problem
This is my first attempt to run an exploration, and
I have questions and also
problems.
The idea is to buy when stochk(14) crosses up
through stochd(14). The position will then be held till until the
Cross(stochkd(14),stochk(14)) occurs.
The first time that I run it, I want
to set this Exploration to run on only one historical day,
so I will set the AA range from 9/2/03 to 9/2/03, and I will
leave the n= box set at 1. Are these the correct range
settings to run it on only one day?
Also, this is my first attempt to use ValueWhen,
and BarsSince. Does it look correctly coded to do what I am wanting to
do? Maybe my
AddColumns are also incorrect.
Additionally,When I try to run
it, I get a syntax error at the right side end of the SellStocVal line of
code.
All help will be appreciated. Ron
D
BuyStocVal=ValueWhen<FONT
size=1>(Cross<FONT
size=1>(StochK<FONT
size=1>(14),<FONT
color=#0000ff size=1>StochD(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),1<FONT
size=1>);
SellStocVal=ValueWhen<FONT
size=1>(Cross<FONT
size=1>(StochD<FONT
size=1>(14),<FONT
color=#0000ff size=1>StochK(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>BarsSince(<FONT color=#0000ff
size=1>Cross(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>StochD(<FONT color=#ff00ff
size=1>14)));
StocRise=SellStocVal-BuystocVal;
Entryprice=ValueWhen<FONT
size=1>(Cross<FONT
size=1>(StochK<FONT
size=1>(14),<FONT
color=#0000ff size=1>StochD(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>Ref(Open,<FONT color=#ff00ff
size=1>0),1<FONT
size=1>);
Exitprice=ValueWhen<FONT
size=1>(Cross<FONT
size=1>(StochD<FONT
size=1>(14),<FONT
color=#0000ff size=1>StochK(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>Ref(Open,<FONT color=#ff00ff
size=1>0),<FONT color=#0000ff
size=1>BarsSince(<FONT color=#0000ff
size=1>Cross(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>StochD(<FONT color=#ff00ff
size=1>14)));
Pricerise=Exitprice-entryprice;
percentrise=pricerise/entryprice;
Filter=Buystocval AND Sellstocval AND stocrise
AND entryprice AND exitprice AND
pricerise;
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Buy
Value"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Sell
Value"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Stoc
Rise"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Buy
price"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Sell
price"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"Price
rise"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);<FONT
color=#0000ff size=1>
AddColumn(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),"%
change"format=<FONT color=#ff00ff
size=1>1.2<FONT
size=1>,textcolor=colorDefault,bkgndcolor=colorDefault);
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|