Monday, December 01, 2008     | Register
TradersStudio Forums
Subject: randomized entries

You are not authorized to post a reply.   
Author Messages
quest
Posts:11

11-01-2006 9:59 AM Alert 

Hi,

Does tradersstudio support the concept of random trade entries? This is the best way I can think of to test exits against a consistent background of entries.

If it does how does it maximize entropy?

If there are better ways of doing this please let me know...

 

D

murray
Posts:431

11-01-2006 10:07 AM Alert 

You would have to create them using the random function in the language.

Rnd( maxVal)

 

Cowpux
Posts:6

12-07-2006 10:23 PM Alert 

Here is a copy of code where I implemented a random entry to test some basic exits.  Normally I set the bias parameter at 0.5.  If the random number is above 0.5 the system goes long.  If it is under 0.5 it goes short.  Here it is:

Sub DHRandomEntry(Bias, mmstp, pflim, maxhold)
   
'Random entry parameter
'Stop loss parameter
'Profit target limit


'maximum holding period

    Dim Trigger
    Dim Signal
    Dim ATR
   

    If BarNumber=FirstBar Then
        Trigger = 0
        Signal = 0
        ATR = 0
       
    End If

    trigger =Rnd()
    If trigger < bias Then
        signal = -1
    End If
    If trigger >1 - bias Then
        signal =1
    End If
    ATR =Xaverage(TrueRange, 50, 0)
'Random Entry
    If signal =1 Then
        Buy("Rnd_Mkt.LE", 1, 0, Market, Day)
    End If
    If signal =-1 Then
        Sell("Rnd_Mkt.SE", 1, 0, Market, Day)
    End If
'Standardized Exits
    If MarketPositionΎ] >0 Then
        ExitLong("MM.LX", "", 1, EntryPrice - mmstp*ATR, Stop, Day)
        ExitLong("Pt.LX", "", 1, EntryPrice +pflim*ATR, limit, Day)
        If barssinceentry -1>=maxhold Then
            ExitLong("Hold.LX", "", 1, 0, market, Day)
        End If
    End If
    If MarketPositionΎ] <0 Then
        ExitShort("MM.SX", "", 1, EntryPrice +mmstp*ATR, Stop, Day)
        ExitShort("Pt.SX", "", 1, EntryPrice - pflim*ATR, limit, Day)
        If barssinceentry -1>=maxhold Then
            ExitShort("Hold.SX", "", 1, 0, market, Day)
        End If
    End If
End Sub

You are not authorized to post a reply.



ActiveForums 3.6
TradersStudio® Copyright 2004-2008 All Rights Reserved   |  Privacy Statement  |  Terms Of Use