EMA+ConfirmBars - futures io
futures io



EMA+ConfirmBars


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,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
 

EMA+ConfirmBars

(login for full post details)
  #1 (permalink)
tradestation18
Porto Portugal
 
 
Posts: 15 since May 2018
Thanks: 0 given, 1 received

I have the following code:

if Price > XAverage( Price, Length ) then
Counter = Counter + 1 else Counter = 0;
if CurrentBar > ConfirmBars and Counter = ConfirmBars then
Buy ( !( "EMACrossLE" ) ) next bar at market;

But the problem is that even if ConfirmBars=0 and Price > XAverage, the code doesnt trigger the Buy Order. It only triggers if the market crosses under and over the XAverage..(?).
It was supposed to trigger the order once the two conditions were filled: Price>XAverage and Counter=ConfirmBars , but it only triggers if Price crosses up the XAverage.

Reply With Quote

Can you help answer these questions
from other members on futures io?
How do I create Strategy with the Second Entry indicator
NinjaTrader
Market on Close data within IB
Platforms and Indicators
Multi Time Frame High/Low/Median levels
NinjaTrader
help with take profit several targets
TradeStation
NT8 Order Management Strategy
The Elite Circle
 
 
(login for full post details)
  #2 (permalink)
Kolnidrei
Lyon/France
 
 
Posts: 23 since Aug 2012
Thanks: 1 given, 14 received

first of all it would be useful to see the code completely,
I suppose Price, Length and ConfirmBars are inputs and counter is a variable.
In this case setting ConfirmBars to 0 should never trigger the buy signal,
it should be set to 1 as minimum...

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
 
Posts: 95 since Sep 2016
Thanks: 7 given, 35 received


If you set confirm bars to 0, then yes this script will buy when price crosses under, because that is when the counter gets reset to 0.

tradestation18 View Post
I have the following code:

if Price > XAverage( Price, Length ) then
Counter = Counter + 1 else Counter = 0;
if CurrentBar > ConfirmBars and Counter = ConfirmBars then
Buy ( !( "EMACrossLE" ) ) next bar at market;

But the problem is that even if ConfirmBars=0 and Price > XAverage, the code doesnt trigger the Buy Order. It only triggers if the market crosses under and over the XAverage..(?).
It was supposed to trigger the order once the two conditions were filled: Price>XAverage and Counter=ConfirmBars , but it only triggers if Price crosses up the XAverage.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #4 (permalink)
tradestation18
Porto Portugal
 
 
Posts: 15 since May 2018
Thanks: 0 given, 1 received

I believe I found the problem. I just add "=" to the condition if CurrentBar >= ConfirmBars, and now it works accordingly:

if Price > XAverage( Price, Length ) then
Counter = Counter + 1 else Counter = 0;
if CurrentBar >= ConfirmBars and Counter = ConfirmBars then
Buy ( !( "EMACrossLE" ) ) next bar at market;

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > EMA+ConfirmBars


Last Updated on May 24, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 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