Need help for currentbar being reset to 1 of my program - EasyLanguage Programming | futures io social day trading
futures io futures trading


Need help for currentbar being reset to 1 of my program
Updated: Views / Replies:415 / 7
Created: by mzhawen Attachments:2

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

 
 
Thread Tools
 

Need help for currentbar being reset to 1 of my program

 
Trading Apprentice
Guangzhou,China
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Emini ES
 
Posts: 6 since Jan 2017
Thanks: 0 given, 0 received

Need help for currentbar being reset to 1 of my program

I wrote a program for find top and bottom of the price. But I find it a problem. After few bars, the program will be restarted, the currentbar will be reset to 1. Please anybody help me, what's the problem of my program as follow:

Var: LastDingNo(1),LastDiNo(0),LastDingBarsBack(0),LastDiBarsBack(0);

LastDingBarsBack = CurrentBar - LastDingNo + 1;
LastDiBarsBack = CurrentBar - LastDiNo + 1;


Once
Begin
Print("Strat");
End;

Print("--------------------");
Print(ELDateToString(Date));
Print("CurrentBar",CurrentBar);

If (LastDingNo>LastDiNO) and (LastDingBarsBack>=5) and Low=Lowest(Low,LastDingBarsBack) then
Begin
Plot1[LastDiBarsBack](High[LastDiBarsBack],"FenXing");
LastDiNo = CurrentBar;
Print("Condition1");
Print("LastDing",LastDingNo);
Print("LastDi",LastDiNo);
Print("LastDingBarsBack",LastDingBarsBack);
Print("LastDiBarsBack",LastDiBarsBack);
End;


If (LastDiNo>LastDingNO) and Low=Lowest(Low,LastDiBarsBack) then
Begin
LastDiNo = CurrentBar;
Print("Condition2");
Print("LastDing",LastDingNo);
Print("LastDi",LastDiNo);
Print("LastDingBarsBack",LastDingBarsBack);
Print("LastDiBarsBack",LastDiBarsBack);
End;


If (LastDiNo>LastDingNO) and (LastDiBarsBack>=5) and High=Highest(High,LastDiBarsBack) then
Begin
Plot1[LastDiBarsBack](Low[LastDiBarsBack],"FenXing");
LastDingNo = CurrentBar;
Print("Condition3");
Print("LastDing",LastDingNo);
Print("LastDi",LastDiNo);
Print("LastDingBarsBack",LastDingBarsBack);
Print("LastDiBarsBack",LastDiBarsBack);
End;


If (LastDingNo>LastDiNO) and High=Highest(High,LastDingBarsBack) then
Begin
LastDingNo = CurrentBar;
Print("Condition4");
Print("LastDing",LastDingNo);
Print("LastDi",LastDiNo);
Print("LastDingBarsBack",LastDingBarsBack);
Print("LastDiBarsBack",LastDiBarsBack);
End;

And the following picture is the printlog:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

 
 
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
 
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,730 since Apr 2013
Thanks: 265 given, 997 received
Forum Reputation: Legendary


mzhawen,

from your description it sounds like the Max Bars for the study are set to automatic and when TS encountered a situation were it had to look back further than this setting, it reloaded the code.

About the Maximum Bars Back Setting
Maximum Number of Bars Study Will Reference Setting

I would try to use a specific value instead of automatic and make sure that this value is higher than the highest values your variables for "LastDingBarsBack" and "LastDiBarsBack" can have.

Regards,

ABCTG

The following user says Thank You to ABCTG for this post:
 
 
Trading Apprentice
Guangzhou,China
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Emini ES
 
Posts: 6 since Jan 2017
Thanks: 0 given, 0 received

ABCTG,

Thanks for your analysis and reply.

I try to comstomized the MaxBarsBack with different value, but it seems work like the same.
Do you have any information for TS operation mechanism, i would like to learn it and try to analyze this problem.

Thanks again for your kindness.

mzhawen

 
 
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,730 since Apr 2013
Thanks: 265 given, 997 received
Forum Reputation: Legendary

mzhawen,

what values did you try?

Regards,

ABCTG

 
 
Trading Apprentice
Guangzhou,China
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Emini ES
 
Posts: 6 since Jan 2017
Thanks: 0 given, 0 received

ABCTG,

I had tried 1 to 10,20,30,50,100, but the printlog stays the same. Actually it stays the same while the MaxBarsBack is "Auto-detect".
To observe the MaxBarsBack, I add "Print(MaxBarsBack)" in my program, it firstly appear as "1". Every time the currentbar changes to 1, the MaxBarsBack changes.

The attched is the printlog.

Regards,

mzhawen

printlog.txt

 
 
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,730 since Apr 2013
Thanks: 265 given, 997 received
Forum Reputation: Legendary

mzhawen,

when you say "Every time the currentbar changes to 1, the MaxBarsBack changes. ", it's actually the other way around. The change in MaxBarsBack causes the reload, which in turn makes the code start over and prints currentbar 1 again.
You need to find out where you look back further than the MaxBarsBack in your code.

It's likely caused by either or both of these variables
 
Code
LastDingBarsBack = CurrentBar - LastDingNo + 1;
LastDiBarsBack = CurrentBar - LastDiNo + 1;
To check this, you could test if you get the same behavior when you limit the value that these variables can have to 10 (for example) or keep them static at 10 and use a MaxBarsBack setting of 50.

Regards,

ABCTG

 
 
Trading Apprentice
Guangzhou,China
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Emini ES
 
Posts: 6 since Jan 2017
Thanks: 0 given, 0 received

ABCTG,

I am a bit following.
And yes there's some code look back further than MaxBarsBack, more exactly, further than that of CurrentBar.

I will try to modify my code, later share you the result.

Thanks a lot for your favor!

Regards,

mzhawen


 



futures io > > > > > Need help for currentbar being reset to 1 of my program
Thread Tools



Upcoming Webinars and Events (4:30PM ET unless noted)

July Journal Challenge - $500 in Amazon Gift Cards!

July
 

AXESS Trader: Powerful Cloud Based Trading Platform w/GFF Brokers

Jul 17

TBA: FuturesTrader71 w/Morad Askar

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
CurrentBar help! kidvic NinjaTrader Programming 5 February 12th, 2016 04:31 AM
Stochastics currentbar -1 Code Question sNeJ88 The Elite Circle 3 September 12th, 2015 05:48 PM
Stochastics currentbar -1 Code Question sNeJ88 NinjaTrader Programming 3 September 12th, 2015 09:14 AM
CurrentBar stepseazy Elite Automated Trading 2 August 31st, 2012 05:36 PM
Powerlangage and Currentbar Laurent EasyLanguage Programming 3 March 12th, 2011 08:33 AM


All times are GMT -4. The time now is 05:52 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2018-07-20 in 0.13 seconds with 15 queries on phoenix