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

[amibroker] Outstanding trades



PureBytes Links

Trading Reference Links




Hi All,
 
I've been delving into the statistics generated by AB.  
One problem I've had is understanding the 
number of trades outstanding at any one time.  I feel 
this is needed to understand how much equity
is needed to support the trades undertaken in a backtest so 
that one can get a proper value
for % return.  The following code addresses that 
need.
 
I've added the following code to the end of my formula.  
One note, I am using the ApplyStop function
so the value of Sell == 4.  Other stops have differing 
values.
 

Equity<FONT 
face=Arial>(1<FONT 
size=2>);     
                
                
                
                
            <FONT 
face=Arial color=#008000>//Performs backtest 
equivalent
AddToComposite<FONT 
face=Arial>(Buy,"~Outstanding Long 
Trades",<FONT face=Arial 
color=#800080>"X"); <FONT 
color=#008000>            
//Add value of 1 to "X" 
fields
AddToComposite<FONT 
face=Arial>((Sell/<FONT face=Arial 
color=#ff00ff>4<FONT 
face=Arial>)*(-1<FONT 
size=2>),"~Outstanding 
Long Trades",<FONT face=Arial 
color=#800080>"X"); <FONT face=Arial 
color=#008000>//Add value of -1 to "X" fields
    
                
                
                
                
                
            //Sell = 4 when using 
ApplyStop<FONT face=Arial 
color=#008000 size=2>
//USAGE(Generate Outstanding Trades)
    
        // Apply to > Filter > Watchlist 
name that holds backtest results
    
        //Range > same as was used in Back 
Test
    
        //Run Scan<FONT 
face=Arial>
    
        //Look in Symbol tree for symbol " 
~Outstanding Long Trades"
    
        //Insert indicator _Outstanding Long 
Trades
 
Here is the 
indicator referred to above.<FONT face=Arial 
color=#008000>
// #### Outstanding Long Trades ####
//#### 6/08/03 #######
Result = <FONT 
size=2>Cum<FONT 
size=2>(High);
Plot<FONT face=Arial 
color=#000000>(Result,"Outstanding Long 
Trades",colorRed,<FONT 
face=Arial color=#ff00ff>3<FONT color=#000000 
size=2>);
PlotGrid<FONT face=Arial 
color=#000000>(2<FONT 
size=2>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(4<FONT 
size=2>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(6<FONT 
size=2>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(8<FONT 
size=2>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>10<FONT color=#000000 
size=2>);
PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>12<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>14<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>16<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>18<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>20<FONT color=#000000 
size=2>);
PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>22<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>24<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>26<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>28<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>30<FONT color=#000000 
size=2>);
PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>32<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>34<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>36<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>38<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>40<FONT color=#000000 
size=2>);
PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>42<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>44<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>46<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>48<FONT face=Arial 
color=#000000>);<FONT face=Arial 
color=#0000ff>PlotGrid<FONT face=Arial 
color=#000000>(<FONT face=Arial 
color=#ff00ff>50<FONT color=#000000 
size=2>);
//###### NOTES ######<FONT face=Arial 
color=#008000>
//This indicator to be used in conjunction with the 
composite
//named ~Outstanding Long Trades 
Insert the indicator in the window and 
select symbol "~Outstanding Long Trades" from the 
symbol tree.  You will be able to read the 
number of outstanding trades from the indicator
and correlate it with the dates shown above on 
the main price chart.
 
Sorry about the extra spacing, but I can't 
change it and keep the color features.
 
I've tested and checked for accuracy but 
not extensively so comments and improvements 
appreciated.
 
 
Regards,
 
Tony

 






Yahoo! Groups Sponsor












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.