'******************************** ' Simple Channel Breakout System with Trade Risk ' TradersStudio(r) 2004-2007 , All rights reserved Sub ChanBreakRisk(SLen) Dim MinMove MinMove=GetActiveMinMove() Buy("ChanBuy",1,Highest(High,SLen,0)+MinMove ,STOP,DAY) Sell("ChanSell",1,Lowest(Low,SLen,0)-MinMove,STOP,DAY) ' If you are flat then you don't know which way the trade will break ' If you are in a trade then risk is the next entry point -reversal point ' So for this system a good estimate of risk on the next trade if filled for this simple system ' is the size of the channel SetTradeRisk(Highest(High,SLen,0)-Lowest(Low,SLen,0)) end sub
TradePlan
Sub TS_PercentRiskPlan(Percent,Ceiling) Dim S As Integer Dim M As Integer Dim DollarPerTrade Dim StartAccount Dim objMark As TSProcessor.IMarket If tradeplan.MarketType=0 Then If Tradeplan.SummEquity MsgBox "not enough money" StopRun End If
If Tradeplan.SummEquity< Tradeplan.TotalMarginForPlan Then MsgBox "Margin Call Account below minimum margin required" StopRun End If End If DollarPerTrade= tradeplan.SummEquity*(Percent/100)
For S = 0 To TradePlan.SessionCount - 1 TradePlan.Session(S).UnitSize = 1
For M = 0 To TradePlan.Session(S).MarketCount - 1 objMark = TradePlan.Session(S).Market(M)
If objMark.TradeRiskSet Then
If objMark.TradeRisk <> 0 Then objMark.EntryNumUnits =Min(Floor(DollarPerTrade/ objMark.TradeRisk),Ceiling) Else objMark.EntryNumUnits=0 End If
objMark.ExitNumUnits = objMark.NumContractsHeld Else objMark.NumUnits = -1 ' use default End If Next Next End Sub
|