PureBytes Links
Trading Reference Links
|
Here is how I do it based on % loss of account equity per trade and a ATR multiple for max loss.
//-----------------------------------------------------------
SetOption("InitialEquity", 100000);
CompoundSwitch = 0;
BuyBarsSince = BarsSince(Buy == 1);
ATROpen = Ref(ATR(20),-BuyBarsSince);
BuyPriceOpen = Ref(BuyPrice,-BuyBarsSince);
HHVOpen = HighestSince(Buy == 1,High,1);
ATRXLoss = 2;
ATRXBELoss = ATRXLoss;
MaxFEATR = (HHVOpen-BuyPriceOpen)/ATROpen > ATRXBELoss;
LossStopLevel = IIf( MaxFEATR == 1, .00001, ATRXLoss*ATROpen);
ApplyStop(stopTypeLoss, stopModePoint, LossStopLevel, 1, True );
PositionNum = 6;
SetOption("MaxOpenPositions", PositionNum );
Capital = GetOption("InitialEquity");
AcctRiskPct = 0.02;
PositionSizeNoCmpd = Capital * AcctRiskPct / (ATRXLoss*ATRopen) * BuyPriceOpen;
PositionSizeCmpd = -100 * AcctRiskPct * BuyPriceOpen / ATRXLoss / ATROpen;
PositionSize = IIf(CompoundSwitch == 0,PositionSizeNoCmpd,PositionSizeCmpd);
//------------------------------------------------------------------
Todd K.
--- In amibroker@xxxxxxxxxxxxxxx, "Corey Saxe" <cesaxe@xxx> wrote:
>
> Been taking a look at AB after being gone for a few years.
>
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|