Long only strategy with the TMA channel

Category: Strategies By: JohnScher Created: December 13, 2019, 9:03 AM
December 13, 2019, 9:03 AM
Strategies
25 Comments

as simple as it gets

I stole the indicator from here.
https://www.prorealcode.com/prorealtime-indicators/tma-center-channel-bands/
Then I rewrote the indicator into a strategy.

The action instruction is Long after the price crosses over (!) the lower band with the target the middle line of the channel.

thats all
until then

//-------------------------------------------------------------------------
// maincode : TMA Channel 4H co lowerband
// coded by johnscher

// works on dax 1 euro
// timeframe 4H
// timezone europetime, berlin
//-------------------------------------------------------------------------

defparam cumulateorders = false

// parameters
HalfLength = 141
AtrLength = 141
AtrMultiplier = 2.4
 
avg = average [1](close)
 
sum = (HalfLength+1)*avg
sumw = (HalfLength+1)
k = HalfLength
 
for j = 1 to HalfLength do
k = k-1
sum = sum+(k*avg[j])
sumw = sumw+k
next
 
 
myrange = AverageTrueRange[AtrLength](close)*AtrMultiplier

middleband = sum/sumw
//higherband = buffer1+myrange
lowerband = middleband-myrange
 

TradingDay = opendayofweek = 1 or dayofweek = 2 or dayofweek = 3  or  dayofweek = 4 or dayofweek = 5
TradingTime = time = 090000 or time = 130000 or time = 170000

IF TradingDay and TradingTime then
if average [1] (close) crosses over lowerband then
buy at market
endif
Endif

if average [1] (close) crosses over middleband then
sell at market
endif


set stop %loss 3
set target %profit 3 // as insurance

Download
Filename: LongOnly-DAX-4H-TMA-Channel.itf
Downloads: 1026
JohnScher Veteran
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

Logo Logo
Loading...