I am striving to build some simple testing of the Norgate premium historical indexes (PDU), and I am getting execution problems due to ReqLotSize. This is not using futures, and my intention is to be able to purchase partial shares, if needed. I have changed everything I can find that should allow this, but nothing seems to work. Due to using adjusted data, some of the individual share prices can become very high.
Specifically, I am getting the error symbol "not entered because of insufficient funds or wrong positionsize/value"; see attached picture.
This particular code intends to buy all shares in the index, dividing the money equally, but I have also tried it using fix $ amounts, as well as with rotation systems, and I am getting similar problems. I have pasted the code and settings; any suggestions is very much appreciated.
Scott
--------------------------------------------------------------
_SECTION_BEGIN("Buy/Sell Setup");
SetBacktestMode( backtestRegular); //
SetOption("InterestRate", 0 );
SetOption("InitialEquity", 200000000 );
SetOption("ActivateStopsImmediately", False );
SetOption("AllowPositionShrinking", True );
SetOption("FuturesMode", False );
SetOption("InterestRate", 0 );
SetOption("MinPosValue", .001 );
SetOption("MinShares", .001 );
SetOption("PriceBoundChecking", True );
SetOption("ReverseSignalForcesExit", True );
SetOption("UsePrevBarEquityForPosSizing", True );
SetOption("HoldMinBars", 0 );
HMindays =Param("HMindays", 0,0,21,1); // hold min # of days - trading Fridays, so now 0
SetOption("HoldMinDays", HMindays );
RModeN = Param("0 TL,1 DL,2 Sum,3 0", 0,0,3,1); // 0 - trade list; 1 - detailed log;2 - summary;3 - no output (custom only)
SetOption("PortfolioReportMode", RModeN );
SetOption("EveryBarNullCheck", False );
SetOption("HoldMinBars", 0 );
SetOption("EarlyExitFee", 0 );
SetOption("HoldMinDays", 0 );
SetOption("EarlyExitDays", 0 );
SetOption("DisableRuinStop", False );
SetOption("GenerateReport", 1 ); //full report
SetOption("ExtraColumnsLocation", 1 ); // working
SetOption( "CommissionMode", 3 ); /* 3 set commissions $ per share; 1=% of trade */
comamt =Param("comamt shr", .01,.0,.1,.01); // sw more conservative ver
SetOption( "CommissionAmount", comamt ); /* per share + SLIPPAGE */
MARGX = Param("marginx", 100, 10, 100, 10); //40 means use up to 60% margin, 100 mean no margin
SetOption ("AccountMargin", MARGX );
MaxPositions = CondOptimize("max pos", 2200,1,2200,2); //Should be the same as the number of stocks being run in order to pass to the backtester
SetOption("MaxOpenLong", MaxPositions );
SetOption("MaxOpenPositions", MaxPositions);
PositionSize = (-100 / (MaxPositions));
//SetPositionSize( 1, 4 ) ; // 4= spsShares (=4) - size expressed in shares/contracts (size must be > 0 )
//SetPositionSize( 30000, 1 ) ; // 1= dollar value of size
SetTradeDelays( 0, 0, 0, 0 );
BuyPrice = CoverPrice = close;
SellPrice = ShortPrice = close;
_SECTION_END();
OnLastTwoBarsOfDelistedSecurity = !IsNull(GetFnData("DelistingDate")) AND (BarIndex() >= (LastValue(BarIndex()) -1) OR DateTime() >= GetFnData("DelistingDate") );
//----------------------------------------------------- Buy Sell ---------------------------*
Buy = IsIndexConstituent("$RUT") AND NOT OnLastTwoBarsOfDelistedSecurity;
Sell = !IsIndexConstituent("$RUT") AND Ref(IsIndexConstituent("$RUT") , -1) ;
Attachment(s) from scwalker1986@gmail.com [amibroker] | View attachments on the web
2 of 2 Photo(s)
Posted by: scwalker1986@gmail.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
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/
EmoticonEmoticon