Help! Struggling with a Keltner channel signal - futures io
futures io



Help! Struggling with a Keltner channel signal


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,291 views
    2. thumb_up 1 thanks given
    3. group 32 followers
    1. forum 2 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Help! Struggling with a Keltner channel signal

(login for full post details)
  #1 (permalink)
 Zen Trader 
Asia
 
Experience: Beginner
Platform: InvestorRT, Ninjatrader
Broker: Zen-Fire
Trading: Bongos
 
Posts: 22 since Jan 2010
Thanks: 37 given, 25 received

Hi, I''m new to Easy Language and need help to understand the following pre-built Keltner channel Buy signal in Multicharts, which unhelpfully has no notes to explain what's going on! So from what I can tell it looks for a channel breakout (price crosses above the upper band) and then sets a buy stop order on the next bar at high + 1 tick. But...

 
Code
[IntrabarOrderGeneration = false]
inputs:  Price( Close ), Length( 20 ), NumATRs( 1.5 ) ;
variables:  var0( 0 ), var1( 0 ), var2( 0 ), var3( false ), var4( 0 ) ;

var0 = AverageFC( Price, Length ) ;
var1 = NumATRs * AvgTrueRange( Length ) ;
var2 = var0 + var1 ;

condition1 = CurrentBar > 1 and Price crosses over var2 ;
if condition1 then                                                                    
begin
	var3 = true ;
	var4 = High ;
end 
else
begin
condition1 = var3 and ( Price < var0 or High >= var4 + 1 point ) ;
 if condition1 then
	var3 = false ;
end;	         	                  

if var3 then 
	Buy ( "KltChLE" ) next bar at var4 + 1 point stop ;

...what I don't understand is:

1) why the code doesn't simply use condition1 to initiate the Buy order i.e.

 
Code
condition1 = CurrentBar > 1 and Price crosses over var2 ;
if condition1 then 
	Buy ( "KltChLE" ) next bar at var4 + 1 point stop ;

2) what's going on in the "else" portion of the if else statement? It seems to be saying, if var3 is true, and either price is below the mid line (var0) or there is a new high, then var3 is false... very confused and I'm not sure why it is necessary.

3) why is "condition1" used twice to define different conditions. In terms of best practice should they not be condition1 and condition2?

4) why var4 is defined within condition1, not outside of it? Does it make any difference?

Really quite confused by this code and appreciate any help

Started this thread Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(391 thanks from 41 posts)
looks_twoSalao's Journalby Salao
(88 thanks from 15 posts)
looks_3Learning to Profit - A journey in algorithms and optionsby Syntax
(59 thanks from 19 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(51 thanks from 25 posts)
looks_5Maybe a little bit different journalby Malykubo
(37 thanks from 23 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
The Crude Dude Oil Trading System
107 thanks
Seasonal Trades
31 thanks
futures io site changelog and issues/problem reporting
26 thanks
Spoo-nalysis ES e-mini futures S&P 500
23 thanks
Cryptocurrencies 101 -- what Ive learned so far
22 thanks
 
(login for full post details)
  #3 (permalink)
 bchip 
Africa
 
Experience: Advanced
Platform: TradeStation
Trading: ES,YM,CL,GC
 
Posts: 98 since Sep 2017
Thanks: 136 given, 76 received



Zen Trader View Post
Hi, I''m new to Easy Language and need help to understand the following pre-built Keltner channel Buy signal in Multicharts, which unhelpfully has no notes to explain what's going on! So from what I can tell it looks for a channel breakout (price crosses above the upper band) and then sets a buy stop order on the next bar at high + 1 tick. But...

I think the key to understanding this bit of code is that it saves certain values
at a point in time. I.e. it saves what the High is when the condition was last met
and then uses that later on.

Pseudo code would be

Get SMA + ATR (Keltner Top)

if price crosses over the Keltner then save condition true (var3) & save this high value (var4)
else
recheck everything ->
-> if in the past var3 was set to true, but now Close < SMA or High > than prev high when condition was met
then set var3 to false again

if var3 = true then buy at High + 1 point

//--------
I think theres some logic missing in the else part that's not right but I suspect what the person
was trying to do was something like -> a signal happens and then there's a pullback afterwards or
price keeps heading higher then do the following [but not finished coding]

HTH

Reply With Quote
The following user says Thank You to bchip for this post:


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Help! Struggling with a Keltner channel signal


Last Updated on March 2, 2020


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April

An Introduction to CME Group Micro Bitcoin Futures w/David Lerman

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts