[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Rules Management for Trading System



PureBytes Links

Trading Reference Links



Hi MG Ferreira:
  Thank you very much, I need time to work on it, and will reply to 
you soon with the same title, and thank for everyone :>
Thank you
Eric

--- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" <quant@xxxx> 
wrote:
> 
> Hi Eric,
> 
> Just a quick, off-the-cuff answer, without ploughing through all
> those formulas and not reading the TASC article.....
> 
> The signals should be exactly the same before and after the
> normalisation.  As you note, this is easy to do for cyclical
> indicators.  You must first try and get the indicator to cross
> zero whenever you enter or exit a strategy.  Say you have a
> moving average crossover strategy, where you use say
> 
> Mov(C,10,S) <> Mov(C,50,S)
> 
> It is easy to get this to cut through zero in stead, simply do
> 
> Mov(C,10,S) - Mov(C,50,S)
> 
> and you have something that signals a buy when it moves above
> zero and vise versa.  We have not altered the signal actually,
> we just moved it down and centered it around the zero line -
> called a locality transformation.
> 
> This thing still has an unbounded range, so next we need to
> scale it.  First, let us call the new signal S, so that
> 
> S = Mov(C,10,S) - Mov(C,50,S)
> 
> Note that we can multiply S with ANY positive value, or scale
> it with any factor, and the result will still cross zero at the
> same time that S would.  So if we transform it to
> 
> T = a . S
> 
> with a > 0 then T will also cross zero at the same time that S
> does and vise versa.  As an example, suppose we have S = -1, 0, 1
> and a = 10, then T = -10, 0, 10 and you can see that they are
> similar - we are just zooming in or out with a.  Please, you have
> to grasp this, as this implies that the signals are not altered
> by the standardisation process!
> 
> Now, how do we choose a?  This is on a case by case basis.  We
> could use, in this example, a = 1 / C, so that
> 
> T = S / C
> 
> We calculate the signal as a percentage of the most recent close
> and this is often used.  Another way is to calculate a = 1 / Std(S)
> so that
> 
> T = S / Std( S )
> 
> and we express it as a ratio to its standard deviation.  Then we
> have the added advantage that if T exceeds 2, we know it is severe,
> and similarly for T below -2 (if you know about the +/- 2 standard
> deviations bit from stats).
> 
> In both cases, a varied over time.  We can also use a constant a,
> which is where we use the series history.  We could use
> a = Max(Abs(S)), so that
> 
> T = S / Max(Abs(S))
> 
> Note that S will never exceed Max(Abs(S)), the maximum value in
> history, so that T will always be between -1 and +1.
> 
> When we transform, we try to get everything between -1 and +1, but
> we are more concerned with keeping the original information intact,
> ie they must cross zero at the same time.  If you have any series,
> you can just use the tanh function to ensure it will be mapped to
> somewhere between -1 and +1, so this is easy to enforce - but it
> makes more sense to use a percentage or standard deviation or some
> other meaningful thing.
> 
> Sometimes it can be tricky.  Let us say you use the RSI, and you
> want to sell when it cuts below 70 and buy when it cuts above 30.
> This is difficult because it does not cut through zero, nor through
> a single value.  So let us do it bit by bit.  First the short part.
> If we define
> 
> Ss = - ( RSI(14) < 70 ) * ( Ref(RSI(14),-1) >= 70 )
> 
> we get a -1 value every time we have to short.  Similarly, we define
> 
> Sl = + ( RSI(14) > 30 ) * ( Ref(RSI(14),-1) <= 30 )
> 
> and we get a +1 every time we have to go long.  Now, we need to
> combine all of this into a single indicator, so we do
> 
> S = Ss + Sl
> 
> but the problem is that this thing has just zeros and a +1 or -1
> only on the day we enter and not thereafter.  So we fix it as 
follows
> 
> S = Ss + Sl + ( Ss = 0 ) * ( Sl = 0 ) * Ref(S,-1)
> 
> Note that we use Ss or Sl, unless they both are zero, then we use
> Ref(S,-1)
> 
> This series has the drawback that it only takes on a +1 or -1 or 0,
> there is nothing inbetween.  So if we need something that also gives
> us an indication of how much 'fat' there is in the system, we
> add the following:
> 
> Vs = RSI(14) - 70
> Vl = RSI(14) - 30
> 
> Here, Vs (value short) is always negative while we are short, since
> we are short if the RSI is below 70.  Similarly, Vl is positive if
> we are long since the RSI is then above 30.  So if we define a new
> signal,
> 
> T = Vs * ( S < 0 ) + Vl * ( S > 0 )
> 
> we get a signal that takes on a value Vs when we are short and Vl
> when we are long.  When we enter a say short position, Vs will be
> very small, and as the ticker drops and the RSI moves away from 70,
> the signal value will increase.  So the larger the signal value,
> the closer we are to exit!  The smaller the value, the more bearish
> we are (or bullish if we are long).  Note this!  If we want to 
change
> it, so that we want to have a large signal when we just enter and
> have it diminish as the trade works in our favour, do something like
> 
> Vs = 30 - RSI(14)
> Vl = 70 - RSI(14)
> 
> Here, when we enter short, the RSI is just below 70 and Vs is almost
> -40.  As the RSI drops down, it gets closer to 30 and Vs falls as
> well.  Now we also have to watch, since if the RSI reaches 30, we
> are still short, but Vs becomes positive.  We can use this to our
> advantage, by exiting at 30 (and at 70 for a long strategy).  So we
> define
> 
> T = min(0,Vs) * ( S < 0 ) + max(0,Vl) * ( S > 0 )
> 
> and we have a new indicator that gets smaller the closer we get to
> exit, which happens at 30 and 70.  The signal itself will be 
somewhere
> between -40 and +40, so we can do
> 
> Tfin = T / 40
> 
> to get something between -1 and +1.
> 
> Finally, I did not test any of these, just typed away, so please
> let me know if you find any bugs in them!  And be aware that they
> may have plenty.
> 
> Regards
> MG Ferreira
> TsaTsa EOD Programmer and trading model builder
> http://tsatsaeod.ferra4models.com
> http://www.ferra4models.com
> 
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, chichungchoi <no_reply@xxxx> 
wrote:
> > 
> > 
> > Hi MG Ferreira:
> > 
> > In selecting indicators, should I evaluate indicators' 
performance 
> > based on their buy and sell signals before normalizating them? or
> > should I normalize indicators before evaluating their performance?
> > if this is the case, could you please tell me how to evaluate 
them 
> > after normalization? since indicators' original buy and sell 
signals 
> > are disappeared.
> > 
> > On the other hand, oscillators are bounded within a limited 
range, 
> > and they are easy to normalize them. However, some momentum 
> > indicators are not bounded within range, I have no idea how to 
> > normalize them, do you have any example to show please? 
> > 
> > There are some example from the article "Normalization" from TASC
> > ======================================
> > CQG FORMULAS
> > Simple moving average oscillator
> > Osc_N1: Osc(@,Sim,4,Sim,8)/MA(@,Sim,8)
> > 
> > METASTOCK FORMULAS
> > I get no idea how to interpret the Osc_N1 format, so I assume as 
> > following
> > Mov(C,4,S)/Mov(C,50,S)-1
> > ======================================
> > CQG FORMULAS
> > Simple moving average oscillator normalized to standard deviation
> > Osc_N2a: Osc(@,Sim,4,Sim,8)/STDDEV(@,8)
> > 
> > METASTOCK FORMULAS
> > Mov(C,4,S)/STDEV(C,8) ???
> > ======================================
> > CQG FORMULAS
> > Simple moving average oscillator normalized to its own historical 
> > range
> > Osc_N3: PCR(Osc(@,Sim,4,Sim,8),200)
> > 
> > METASTOCK FORMULAS
> > ???
> > ======================================
> > 
> > Thank you
> > Eric








------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/