# explain the code part

#### sr114

##### Well-Known Member
Hello

need following explanation urgently:

1. Find SLOPE A of 30TEMA in % change of TEMA value from open of CURRENT candle to the present value of TEMA

Is a slope in Degrees? No.

Why. it cannot be in degrees because degrees change with the zoom level in AMI. The simplest way to express it is "change in 30TEMA per minute in % TEMA”

For example, if CURRENT 30TEMA of a stock is at 100/-, and at OPEN it was 99/- then change =1/- =1% If the change has come in 45 seconds then SLOPE= 1 % per 45 secs= [1 * 60] /[100 * 45] PERCENT PER MINUTE (ppm)

defn : Slope_t30 = 1000*((t30- Ref(t30, -1))/t30);
where t30 = tema30

ENTRY RULES:
slope of tema30 >=(specified slopeor factor) (an user supplied factor in the param window)

exit rules
a) when (tema5) and (tema7) cross over
or
b) t5 slope reverses and takes a slope=ppm in the other direction

So basically this is a 3 tema based system. temas' used are tema5,tema7 and tema3.

we will go long when close price is above tema30 along with the slope of tema30 increasing and greater than the supplied factor

will go short when close is below tema 30 along the slope of the tema 30 decreasing and is low than the supplied factor (input in parameter window)

buy exit when t5 and t7 crosses or sell exit when t7 and t5 crosses or overall the slope of the tema5

wrote the logic but its becoming a more stop and reverse system - which is not intended. so please help - in definging the entry and exit rules

entry codes: [ is it correct?]
Sell = dn AND slope_t < fact AND timewindowtrade ;

exit codes: [ is it corect?]
shtrig = slope_t < fact; (slope_t = slope of tema30)
cvrtrig = slope_t > fact;

Short= (t7 > t5 AND shtrig AND dn) AND timewindowtrade ;
Cover= (t5 > t7 AND cvrtrig AND up)

[up - c>tema30, dn= c<tema30]
[timewindowtrade (exchange time) - 0915 to 1525]

please help to write the code efficiently. lastly - mo of the stars (plotshapes associated with the exit part r coming - how to reduce them - using exrem also but problem exists)

rgds
subroto

Last edited: