[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] backtesting



PureBytes Links

Trading Reference Links

Hi Howard,
                i'm wondering if you know what this means,,
 
when i run the exploration one day and then backtest for the following day to see if it selects the same stock ....
 
i'm finding that the program is just about always selecting the first stock that has a positionscore value of 1.#J or -1.#J instead of selecting the stock that has the highest positionscore value.
 
 I'm assuming it's some computer language but wondering why it's mixing in with typical counting,,,well not actually wondering why but wondering how to fix it please ???
 
regards
Paul
 
 
 
----- Original Message -----
From: Paul Radge
Sent: Saturday, September 27, 2008 10:25 PM
Subject: Re: [amibroker] backtesting

Hi Howard,
                I just returned from the Alpine region of Victoria and downloaded the mass's of Amibroker emails ,i was lucky enough to spot your reply amongst them,thank you.
 
 I'll now make a cup of tea and have a play with the new code,
warm regards
Paul
      (ps thanks for fixing my Christian name up too, from my unfamilar cousin's.)
 
 
----- Original Message -----
From: Howard B
Sent: Thursday, September 25, 2008 8:22 AM
Subject: Re: [amibroker] backtesting

Paul -- I meant Paul.



On Wed, Sep 24, 2008 at 3:21 PM, Howard B <howardbandy@gmail.com> wrote:
Hi Nick --

I've taken the liberty of starting with your first code segment, adding some comments, and making
some changes.  I may not have gotten all of your preferences correct, but try this
and see if it helps.

Thanks,
Howard

////////////////////////////////////////////////////

// radge1.afl

//Day Trade

InitEquity = 100000;
SetOption("InitialEquity",InitEquity);

SetTradeDelays (1,1,0,0); // Explore today trade tomorrow


// Number of positions to hold
MaxQty = 10;
SetOption("maxopenpositions",MaxQty);


//    Uncomment the way you want to set position size

// $5000 for each trade
// PositionSize = 5000;

// positionsize is proportional to maximum number held
PositionSize = -100 / MaxQty;



// PositionScore is the ratio of 1 day rate of change to 10 day rate of change
// unless the 1 day rate of change is zero, PositionScore will always be non-zero
// that is, PositionScore will always be True
PositionScore = ROC(C,1) / ROC(C,10); //looking for a big move compared to the last 2 weeks


//  Since PositionScore is always True,
//    Filter is True when Close > Open.
// Filter = PositionScore AND Close > Open; //looking for the biggest move on an up day.
Filter = Close > Open;

// Set a buy signal
BuySignal = Filter;


// Buy whenever today's close is greater than
//    today's open.
// But not two days in a row.
Buy = BuySignal AND NOT(Ref(BuySignal,-1));

// BuyPrice is tomorrow's Open
BuyPrice = Open;
 

// As it stands, the original statement says Sell whenever Close is not Zero.
// You want to sell on the same day you bought.
Sell = Buy;


// You might mean SellPrice = Close?
SellPrice = Close;
 
AddColumn(PositionScore,"score"); //lets me see the score values in an exploration
 

// if anyone could advise on the above idea i would appreciate the help,,,


 


//////////////////////////////////////////////////////


On Mon, Sep 22, 2008 at 4:04 AM, Paul Radge <paulradge@xxxxxxxxxcom.au> wrote:

Hi all,
         i recently read a few posts here in the forum and learnt about the function "positionscore".As a non programer i find the forum very usefull.
 
 From those posts i've tried to follow a similar line and test a day trading system,,,like many of my ideas and notions though it may bare no cash flow.
 
What i tried to do was look for a break out and then buy the open next day and sell the close as a true day trade no money down.Here's what i attempted
 
//Day Trade
positionscore = ROC(c,1) / ROC(C,10); //looking for a big move compared to the last 2 weeks
 
Filter = Positionscore and Close > Open; //looking for the biggest move on an up day.
 
Buy = Filter;
Buyprice = Open;
 
Sell = close;
 
settradedelays = (1,0,0,0); // Explore today trade tomorrow (?)
positionsize = 5000;
 
addcolumn(positionscore,"score"); //lets me see the score values in an exploration
 
//I've got maxtrades set to 1 within settings
 
When i explore from 18/9/08 to 18/9/08 i get stock abc.asx for example but when i backtest from 19/9/08 to 19/9/08 i'm not getting the same ticker that i expected to see traded with the Buy delay set to 1.
 
 If anyone could advise on the above idea i would appreciate the help,,,
 
i also tried this with no luck,,,,,,,,,,,
 
positionscore = ROC(C,1) / ROC(C,10);
 
cond1 = c > o;
 
longsetup = postionscore and cond1;
 
filter = ref(longsetup,-1);
 
buy = filter ;
buyprice = open;
sell = close;
 
settradedelays = (0,0,0,0);
positionsize = 5000;
 
addcolumn(positionscore,"score");


__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___