professor_frink
Moderator
- Joined
- 16 February 2006
- Posts
- 3,252
- Reactions
- 5
Typical of shorts, we need to take our profits quicker. So we should have a separate stop for the short trades. Any suggestions on how to differentiate the codefor the two differentstops?
Heres the code i'm currently using (i changes the liquidity threshold):
Hi canuck,
I can't seem to figure out what the entry + exit criteria is
I know we are looking for a reduction in the daily range as one of the parameters, but what actually triggers the entry?
Lesm's code doesn't make much sense to me(that's saying something about me, not the code Les)
It looks for 3 inside days with this:
InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;
Then determines whether to go long or short with this:
an EMA (35), but it goes long on a close > than "EMABuyCond = EMA(C, 35);" and shorts on a low less than "EMAShortCond = EMA(L, 35);"
Here's the buy signal...it has a volumecondition too.
BuySig = InsideDayCond AND HVRatioCond AND VolumeCond AND C > EMABuyCond ;
Heres the short signal:
ShortSig = InsideDayCond AND HVRatioCond AND VolumeCond AND Low < EMAShortCond;
I'm trying to figure out how to change the cover signal...so it gets out of the short trade sooner. It identifies short really well in what i've seen so far, it just hangs on too long turning a profit into a loss.
This is kinda fun...
cos i'm on holidays!
Cheers,
OK gotcha. There doesn't seem to be any exit conditions as yet. Correct?
But he's got this ready to be considered:ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );
// Cover Condition
// CoverSig = condition .......
Short = ShortSig;
//Short = ExRem(ShortSig, CoverSig);
//Cover = ExRem(CoverSig, ShortSig);
CanOz said:Only a stop loss, so yes thats correct:
But he's got this ready to be considered:ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );
...its only the "//" comment markers that disable it, it needs a condition to cover defined...so what should we use...it needs to be something that covers once you have three strong closes...like three up days...like this// Cover Condition
// CoverSig = condition .......
Short = ShortSig;
//Short = ExRem(ShortSig, CoverSig);
//Cover = ExRem(CoverSig, ShortSig);
Here's my suggestions to gauge whether it is a (short term) system worth trading.Further to this and along Bany's lines of progress, its suggested that before we move on we select an objective function. The objective function will be used to measure the effectiveness of our system in the tests that we run. To me this makes sense as you need to decide what factors are most important to you before you start testing, otherwise what are you trying to achieve by testing?
Can we have some discussion about this?
We want things like:
1.) low drawdown
2.) frequent trades
3.) short holding period
4.) high percent annual gain
etc.
For myHere's my suggestions to gauge whether it is a (short term) system worth trading.
1) Drawdown < 40% - I think it will become very hard to sit through anything worse than that without wanting to intervene.
2) > 100 trades (Assuming 1 year of trades)
3) Average holding < 5 days and (average hold for losing trades) < (average hold winning trades)
4) I don't think we want to set a target for annual % gain, that will come automatically once we've taken care of the rest. Maybe consider setting targets on % winning trades (target > 35%) and win/loss ratio > 2.
/*
ASF Sample System Development Version 1.0
*/
// Define system options can modify these as required
SetChartOptions( 2, chartShowDates|chartShowArrows );
SetBarsRequired(10000,10000);
SetTradeDelays( 1, 2, 1, 2);
SetOption( "initialequity", 100000 );
SetOption( "MaxOpenPositions", 10 );
SetOption( "PriceBoundChecking", 1 );
SetOption( "CommissionMode", 1 );
SetOption( "CommissionAmount", 0.1 );
BuyPrice = SellPrice = Open;
ShortPrice = CoverPrice = Open;
Buy = Sell = Short = Cover = 0;
PositionSize = -10; // always invest 10% of the current Equity
// Setup Conditions
VolumeCond = EMA(V * C, 21) > 500000; // Ensure at least $500k of money flow for 21 periods
// Long side - buy and sell conditions
BuySig = Open > Ref(C,-1)<O AND Ref(V,-1)> (2*Ref(EMA(V,13),-1)) AND C>Ref(C,-1) AND ( Ref(H,-1)-Ref(L,-1))< Ref(EMA(H-L,13),-1) AND VolumeCond;
SellSig = 1;
Buy = ExRem(BuySig, SellSig);
Sell = ExRem(SellSig, BuySig);
// Short side - Short and Cover conditions
ShortSig = Open < Ref(C,-1)<O AND Ref(V,-1)> (2*Ref(EMA(V,13),-1)) AND C>Ref(C,-1) AND ( Ref(H,-1)-Ref(L,-1))< Ref(EMA(H-L,13),-1) AND VolumeCond;
CoverSig = 1;
Short = ExRem(ShortSig, CoverSig);
Cover = ExRem(CoverSig, ShortSig);
//Define Stoploss Conditions
ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );
//Lists exploration results conforming to our Buy/Sell OR Short/Cover criteria
Filter = Buy OR Sell OR Short OR Cover;
AddColumn(Buy, "Buy", 1, colorDefault,IIf(Buy,colorGreen,colorDefault));
//AddColumn(Sell, "Sell", 1, colorDefault,IIf(Sell,colorRed,colorDefault));
AddColumn(Short, "Short", 1, colorDefault,IIf(Short,colorGreen,colorDefault));
//AddColumn(Cover, "Cover", 1, colorDefault,IIf(Cover,colorRed,colorDefault));
AddColumn(Open, "Open", 4.3);
AddColumn(Low, "Low", 4.3); //
AddColumn(High, "High", 4.3); //
AddColumn(Close, "Close", 4.3); //
I was wondering if that was going to resurface. I'm rather fond of it, but think its a fair way off being tradeable. Also, I don't think going short is as simple as reversing the buy condition. The logic for the system was based on something intended for long trades.
Need to tend to dinner, but will come back with more later. Will also run it thru tradesim.
Doc,
As you originally mentioned it was a bit quick and rough at the time, but it is a starting point.
Yes, quite true, going short is not necessarily as simple as reversing the buy condition.
If you are going to run it through Tradesim and you have the Enterprise edition, would you mind doing a quick Monte Carlo analysis on it?
Cheers.
lesm, I'm in the process of translating your exits to metastock language. It's been a while since I've used AB, so I'm struggling a little.
I see your stop loss, but how does your code account for exiting a winning trade (a trailing stop)?
Hmmm I smell a rat.
Perhaps someone else can run it while I work out what I did wrong
Doc..Not sure if you meant to leave it out but with $30 a side brokerage... might look different.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?