Forum Replies Created
-
AuthorPosts
-
ZachSwannMember
That’s a few parts of the puzzle I was hoping to get the rank before preprocess because the idea I have is percentage based risk parity and sig.possize only accepts a number not an array. Any other ideas?
ZachSwannMemberI have had a bit of a play with it and this is what I don’t know
symlist part is there an easy way to get a whole watchlist as a string?
The static variable below I think it puts them in order and returns a string. I think you create a loop similar to Cnt loop in a previous post but I am not sure what to use instead of getfirstsignal and getnextsignal because if that is used I can’t use an array which I want too.symlist = “C,CAT,DD,GE,IBM,INTC,MSFT”;
// delete static variables – DO NOT forget the asterisk (wildcard) at the end
StaticVarRemove( “ValuesToSort*” );// fill input static arrays
for ( i = 0; ( sym = StrExtract( symlist, i ) ) != “”; i++ )
{
SetForeign( sym );
Value = ROC( C, 10 );
RestorePriceArrays();
StaticVarSet( “ValuesToSort” + sym, Value );
}// perform ranking
StaticVarGenerateRanks( “rank”, “ValuesToSort”, 0, 1224 ); // normal rank mode// read ranking
rk = 0;
for ( i = 0; ( sym = StrExtract( symlist, i ) ) != “”; i++ )
{
StaticVarGet( “RankValuesToSort” + sym );
rk++;
}
//=================================================================================
_SECTION_END();This is current code doesn’t work but maybe I am not seeing something dead simple
ZachSwannMemberFair Point
November 25, 2017 at 6:34 am in reply to: Selection bias – how much is too much and general MOC discussion #108044ZachSwannMemberI thought the reason to half it was if the intraday prices all had lows at the same time on a black swan event. IB would auto liquidate If share were more then 4:1
ZachSwannMemberDone that already I thought there might have been away around that other just excluding
ZachSwannMemberWith your island share code does code does that just exclude from exploration and backtest? And Island Share your talking Island exchange ?
ADES is on 2 exchanges LSE and NASDAQZachSwannMemberNot a 5 cent share
Error says it’s ambiguous is that the normal error for an island share?ZachSwannMemberAny Idea why?
November 21, 2017 at 12:09 pm in reply to: Selection bias – how much is too much and general MOC discussion #105783ZachSwannMemberI have just had a thought in regards to Kelly criterion and leverage. For example if the result you get out of the Kelly criterion formula is 20% and no leverage. If 4:1 leverage position size 5%.
What everyone elses thoughts?ZachSwannMemberI think the problem was using the vps through my phone and double clicking in IB
ZachSwannMemberMyo in radge api I not sure could be just a brain fart on behalf
ZachSwannMemberStrange order for myo.asx but order went into mqa.asx any ideas why?
ZachSwannMemberStaticVarGenerateRanks I didn’t even know that existed.
That would be before all the backtesting code I gather?ZachSwannMemberSHLM – 5 Cent List
ZachSwannMemberI answered most of my own question but any ideas how to Param sig.PosSize??
//=================================================================================
//Backtesting Parameters
//=================================================================================
posqty = Param(“# Positions”,20,1,100,1);
Eq = Param(“Initial Equity”,100000,1,10000000,1);
SetOption(“InitialEquity”,Eq);
SetOption(“MaxOpenPositions”,posqty);
SetOption(“UsePrevBarEquityForPosSizing”,True);
SetOption(“AccountMargin”,100);
SetTradeDelays(0,0,0,0);
SetOption(“UseCustomBacktestProc”, True );if( Status(“action”) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
for( bar = 0; bar < BarCount; bar++ )
{
Cnt = 1;for( sig = bo.GetFirstSignal( bar ); sig; sig = bo.GetNextSignal( bar ) ) // Cnt Ends up being the rank
{
if( Cnt == 1) sig.PosSize = -20; // sig.PosSize If -20 is 20% of portfolio If +20 is $20
if( Cnt == 2) sig.PosSize = -5; // -param wouldn’t work for me not sure why
if( Cnt == 3) sig.PosSize = -5;
if( Cnt == 4) sig.PosSize = -5;
if( Cnt == 5) sig.PosSize = -5;
if( Cnt == 6) sig.PosSize = -5;
if( Cnt == 7) sig.PosSize = -5;
if( Cnt == sig.PosSize = -5;
if( Cnt == 9) sig.PosSize = -5;
if( Cnt == 10) sig.PosSize = -5;
if( Cnt == 11) sig.PosSize = -5;
if( Cnt == 12) sig.PosSize = -5;
if( Cnt == 13) sig.PosSize = -5;
if( Cnt == 14) sig.PosSize = -5;
if( Cnt == 15) sig.PosSize = -5;
if( Cnt == 16) sig.PosSize = -5;
if( Cnt == 17) sig.PosSize = -2.5;
if( Cnt == 18) sig.PosSize = -2.5;
if( Cnt == 19) sig.PosSize = -2.5;
if( Cnt >= 20) sig.PosSize = -2.5;
Cnt++;
}
bo.ProcessTradeSignals( bar );
}
bo.PostProcess();
}wr = Param(“Worst Rank”,20,1,20,1);
SetBacktestMode(backtestRotational);
SetOption(“WorstRankHeld”,wr);
EOM = Month() != Ref(Month(),-1);//First trading day of the month
score = Ref(Rank,-1);//score is the rotational criteria
Score = IIf(LE,score,0);
PositionScore = IIf(Year()>=1985 AND EOM,Score,scoreNoRotate);
//
-
AuthorPosts