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

Re: [amibroker] coding challenges - getting trading system information



PureBytes Links

Trading Reference Links

Yuki:

Perhaps a 2 pass approach would do part of what you want. 

Pass 1 could create several composites (AddToComposite)
counting the number of Buy signals, number of Short
signals, and total number of signals.

Pass 2 would call these composites (Foreign) and you could
divide them by each other to give you percentage of Buy vs
Short. 

The above assumes one is doing a back test. It should also
work for displaying a chart so you can visually inspect the
numbers and their interplay. 

As for different nBar stops for Long and Short positions
there might be a way, my mind is starting to go foggy, but
I think there might be a way -- if one can determine if the
current trade is a Long or Short. 

IsLong = ... code to determine if Long or Short...
nBarLong = 25;
nBarShort = 12;
//ApplyStop paramaters
asType = 3;//0=stop loss, 1=target, 2=trailing 3=nBar
asMode = 2;//1=nBar/percent, 0=disable, 1=points, 3=profit
asAmount =  Iif( IsLong, nBarLong, nBarShort) ;
asExit = 0;//0=regular trade price used for stops
asVolatile = True;//true => dynamic values for asAmount
asReEntryDelay = 5; 
ApplyStop(asType, asMode, asAmount, asExit, asVolatile,
asReEntryDelay);

Although it might not be necessary, it likely would not
hurt to use the "volatile" flag in ApplyStop so the nBar
value is variable rather than fixed.
AFL manual = "volatile - decides if amount (or distance)
(3rd parameter) is sampled at the trade entry and remains
fixed during the trade (Volatile = FALSE - old behaviour)
or if can vary during the trade (Volatile = TRUE) (allows
single line Chandelier exit implementation)" 



--- Yuki Taga <yukitaga@xxxxxxxxxxxxx> wrote:

> Is there any way other than by time-consuming inspection
> of the trade
> list (which would be thousands of trades) to find out the
> following
> bits of information:
> 
> 1) The average number of signals per day?  This would be
> for an
> "always in" system, trading at or very near the close, so
> I would
> have to limit the number of symbols in the trading basket
> to quite an
> extent.  But that extent would depend somewhat on the
> average number
> of signals per day, and . . .
> 
> 2) How many times the maximum (all the symbols in the
> trading basket)
> signalled on the same day?
> 
> 3) If possible, I'd also like to know how often, and/or
> for how long,
> the system went 100 percent one way or the other.  At the
> moment, the
> system is 90 percent long, 10 percent short.  If I could
> get a graph
> or even statistical data to give me a running history of
> this ratio,
> that would be great.
> 
> My last question has to do with nBar apply stops.  Is
> there a way to
> write an nBar stop that is X for closing long positions
> and Y for
> closing short positions?  I am not even sure if I would
> need one
> statement, or separate statements.  And I would only be
> looking for
> the nBar to trigger at X or Y bars ONLY if the positions
> were
> profitable at the time.  (Statistically, they would
> probably already
> be reversed if they were not profitable by the number of
> bars I'm
> thinking of, but not in every case of course.  Still, I
> am only
> thinking of short-circuiting profitable trades at the
> moment.) It
> would seem my average winner runs about 25 bars, while
> the average
> loser runs less than half that. So, I'd be looking at
> around, say,
> the 20 bar mark, a point at which few losing trades would
> still be
> alive anyway.
> 
> Help gratefully appreciated.
> 
> Yuki
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hnio4tn/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123993992/A=2894354/R=0/SIG=11qvf79s7/*http://http://www.globalgiving.com/cb/cidi/c_darfur.html";>Help Sudanese refugees rebuild their lives through GlobalGiving</a>.</font>
--------------------------------------------------------------------~-> 

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 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/

<*> 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/