Confused about "Currentbar", using Ichimoku Cloud - EasyLanguage Programming | futures io social day trading
futures io futures trading


Confused about "Currentbar", using Ichimoku Cloud
Updated: Views / Replies:981 / 9
Created: by WPITrader Attachments:0

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 90,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

Reply
 
Thread Tools Search this Thread
 

Confused about "Currentbar", using Ichimoku Cloud

  #1 (permalink)
Trading Apprentice
Boston
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Guitar
 
Posts: 5 since Mar 2015
Thanks: 0 given, 0 received

Confused about "Currentbar", using Ichimoku Cloud

Hi all,

I'm new to the forum, and have joined because I am a college student working on a year long junior project that involves developing an automated trading system. Everything that I have learned in regards to EasyLanguage is self taught, and i've found that some of the syntax can be kind of difficult.

So to get down to my question:
It may seem very amateur, but I can assure that I have really looked in a lot of different corners of the internet for this answer, but it is still unclear to me. I am creating a strategy program that involves the Ichimoku Cloud indicator. Simply put, when certain lines of the indicator cross above or below other certain lines, it will give me a long or short signal. Whether or not I take the position is determined on whether the indication holds true for a certain amount of bars. I thought that this can be done by using "Currentbar > (number of bars to meet condition)". The number that is put will be the number of closed bars that are needed to confirm the indicator, after the initial crossing of the Ichimoku lines, and enter a position.
ex: If Currentbar > 3 and Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud then
Buy next bar at market
With this code, I am trying to take a long position if the Chikou_Offset line crosses above both lines of the cloud and stays like that for 3 bars after the initial cross.

I am not sure if I am using this function the right way, but I am having a lot of trouble with my strategy code not entering the market a certain number of bars after the initial signal, confirming the signal. If anyone could give me some pointer or tips on this particular subject I would be very grateful. I feel like this is simple, but yet It just isn't working like I need it to. Thank you very much in advanced.

Reply With Quote
 
  #2 (permalink)
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.

 
  #3 (permalink)
Elite Member
Texas, USA
 
Futures Experience: Intermediate
Platform: X_TRADER Pro, Custom
Broker/Data: NxCore
Favorite Futures: Futures, Spreads
 
Hulk's Avatar
 
Posts: 215 since May 2014
Thanks: 509 given, 474 received



WPITrader View Post
Whether or not I take the position is determined on whether the indication holds true for a certain amount of bars. I thought that this can be done by using "Currentbar > (number of bars to meet condition)". The number that is put will be the number of closed bars that are needed to confirm the indicator, after the initial crossing of the Ichimoku lines, and enter a position.
ex: If Currentbar > 3 and Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud then
Buy next bar at market
With this code, I am trying to take a long position if the Chikou_Offset line crosses above both lines of the cloud and stays like that for 3 bars after the initial cross.

Option 1: Store your condition true bar number in a variable:

 
Code
Vars:
    LongConditionBarNumber(0);

...

If (LongConditionBarNumber = 0 and Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud) then
    LongConditionBarNumber = BarNumber
Else
    LongConditionBarNumber = 0;

if (LongConditionBarNumber > 0 and BarNumber-LongConditionBarNumber > 3) then begin
    Buy Next Bar at Market;
    LongConditionBarNumber = 0;
end;

Option 2: Look back on the entire condition
 
Code
Vars:
    BarsToWait(3);

...

If (Close[Chikou_Offset+BarsToWait] > TopOfCloud[BarsToWait] and Close[Chikou_Offset+BarsToWait] > BottomOfCloud[BarsToWait]) then
    Buy Next Bar at Market;

Option 3: Store true/false condition in a boolean variable
 
Code
Vars:
    LongCondition(False);

...

LongCondition =  Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud);

if (LongCondition[3]) then begin
    Buy Next Bar at Market;
    LongCondition = False;
end;
I havent verified any of this code so there might be syntax errors but this should be good enough to give you a general idea about how you can approach your problem.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Boston
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Guitar
 
Posts: 5 since Mar 2015
Thanks: 0 given, 0 received

Thanks a ton Hulk. I am currently trying out option 3. Do you think there is a specific benefit to each, or one in particular? Or do they all do the same thing?

Thank you again.

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Boston
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Guitar
 
Posts: 5 since Mar 2015
Thanks: 0 given, 0 received


Hulk View Post
Option 1: Store your condition true bar number in a variable:

 
Code
Vars:
    LongConditionBarNumber(0);

...

If (LongConditionBarNumber = 0 and Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud) then
    LongConditionBarNumber = BarNumber
Else
    LongConditionBarNumber = 0;

if (LongConditionBarNumber > 0 and BarNumber-LongConditionBarNumber > 3) then begin
    Buy Next Bar at Market;
    LongConditionBarNumber = 0;
end;

Option 2: Look back on the entire condition
 
Code
Vars:
    BarsToWait(3);

...

If (Close[Chikou_Offset+BarsToWait] > TopOfCloud[BarsToWait] and Close[Chikou_Offset+BarsToWait] > BottomOfCloud[BarsToWait]) then
    Buy Next Bar at Market;

Option 3: Store true/false condition in a boolean variable
 
Code
Vars:
    LongCondition(False);

...

LongCondition =  Close[Chikou_Offset] > TopOfCloud and Close[Chikou_Offset] > BottomOfCloud);

if (LongCondition[3]) then begin
    Buy Next Bar at Market;
    LongCondition = False;
end;
I havent verified any of this code so there might be syntax errors but this should be good enough to give you a general idea about how you can approach your problem.

So after trying all three, the 2nd one has been able to generate orders. The 1st and 3rd when put in did make any order entries, and I'm still trying to figure out why.

As for the second one, it works! A problem I am running into though is that both the buy and sell signals are being generated in the same bar. I guess I need the variable to reset after an order has been made and a position is take? I did already go to rightclick > Format strategies > select my strategy and format > and I don't have intrabar trading enabled.
Any ideas?
Thanks

EDIT:
One thing that I have been thinking about is whether I am getting trouble from the line I am referring to for an indication. The "Chikou" line is the close of the current price offset 26 days in the past, for those who aren't familiar with Ichi Clous. Since this line is offset in the past, does the coding change? I am getting entries and exits in really odd places. The entries are places where it is perfectly apparent that the conditions haven't been met.


Last edited by WPITrader; March 29th, 2015 at 11:09 PM.
Reply With Quote
 
  #6 (permalink)
Elite Member
Texas, USA
 
Futures Experience: Intermediate
Platform: X_TRADER Pro, Custom
Broker/Data: NxCore
Favorite Futures: Futures, Spreads
 
Hulk's Avatar
 
Posts: 215 since May 2014
Thanks: 509 given, 474 received


WPITrader View Post
So after trying all three, the 2nd one has been able to generate orders. The 1st and 3rd when put in did make any order entries, and I'm still trying to figure out why.

I was just trying to show you different ways of programming checks for conditions that were true a few bars ago. If any one works for you, just use that.


WPITrader View Post
As for the second one, it works! A problem I am running into though is that both the buy and sell signals are being generated in the same bar. I guess I need the variable to reset after an order has been made and a position is take? I did already go to rightclick > Format strategies > select my strategy and format > and I don't have intrabar trading enabled.
Any ideas?
Thanks

It does not look like it has anything to do with intrabarordergeneration (IIOG). Probably has to do with both long and short conditions being true at the same time.


WPITrader View Post

EDIT:
One thing that I have been thinking about is whether I am getting trouble from the line I am referring to for an indication. The "Chikou" line is the close of the current price offset 26 days in the past, for those who aren't familiar with Ichi Clous. Since this line is offset in the past, does the coding change? I am getting entries and exits in really odd places. The entries are places where it is perfectly apparent that the conditions haven't been met.

Sorry, I havent the slightest clue what a "Chikou" or an "Ichi Clous" is. I can give you pointers on programming related stuff but you are on your own as far as your strategy is concerned.

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Boston
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Guitar
 
Posts: 5 since Mar 2015
Thanks: 0 given, 0 received


Hulk View Post
I was just trying to show you different ways of programming checks for conditions that were true a few bars ago. If any one works for you, just use that.


It does not look like it has anything to do with intrabarordergeneration (IIOG). Probably has to do with both long and short conditions being true at the same time.



Sorry, I havent the slightest clue what a "Chikou" or an "Ichi Clous" is. I can give you pointers on programming related stuff but you are on your own as far as your strategy is concerned.

Oh ok. well so far 2 out the 3 work. I do understand the syntax you are using though, very helpful, and it's logic I haven't thought of yet.

As far as the Chikou, and I misspelled, "Ichi Cloud"(not clous), It's ok. Ichimokou Cloud is the type analysis I'm using.

For the "Chikou" , or in English, "lagging", this is a lagging line, that plots the close of the current price, 26 bars back. So forgetting about the type of analysis it is for a sec, if I was to make a buy and sell signal based off of a line that is plotted 26 bars behind the current bar, what would be my coding to refer to this offset line, and check if it has satisfied a condition?
Thanks

Reply With Quote
 
  #8 (permalink)
Elite Member
Texas, USA
 
Futures Experience: Intermediate
Platform: X_TRADER Pro, Custom
Broker/Data: NxCore
Favorite Futures: Futures, Spreads
 
Hulk's Avatar
 
Posts: 215 since May 2014
Thanks: 509 given, 474 received


WPITrader View Post
if I was to make a buy and sell signal based off of a line that is plotted 26 bars behind the current bar, what would be my coding to refer to this offset line, and check if it has satisfied a condition?
Thanks

Try to store the conditions in true/false variables and then check if those variables are true or false to enter a position. If you want to check if those conditions were true 3 bars ago, you can check that using "[3]" suffixed to the variable name or "[26]" suffixed if you were checking for the condition 26 bars ago.

Use the print statement to print the values of the variables for each bar, this is one way of "debugging" in EL (unless they allow actual breakpoints now, I dont know) that I have used extensively to troubleshoot. The sample below prints the bar date/time first and then whatever variable values you want separated by the pipe "|" symbol.

 
Code
	Print(Bardatetime[0].ToString(), " | ", Variable1, " | ", Variable2, " | ", ...);

Reply With Quote
 
  #9 (permalink)
Trading Apprentice
Boston
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Guitar
 
Posts: 5 since Mar 2015
Thanks: 0 given, 0 received


Hulk View Post
Try to store the conditions in true/false variables and then check if those variables are true or false to enter a position. If you want to check if those conditions were true 3 bars ago, you can check that using "[3]" suffixed to the variable name or "[26]" suffixed if you were checking for the condition 26 bars ago.

Use the print statement to print the values of the variables for each bar, this is one way of "debugging" in EL (unless they allow actual breakpoints now, I dont know) that I have used extensively to troubleshoot. The sample below prints the bar date/time first and then whatever variable values you want separated by the pipe "|" symbol.

 
Code
	Print(Bardatetime[0].ToString(), " | ", Variable1, " | ", Variable2, " | ", ...);



sorry it's taken me a little a while to respond.

For that print statement, do I have to make a new variable for the "Bardatetime", or should I put in the bar, date and time I want to check? and in what format? The only reason I ask is because when I copy in the code, I replace the "Variable1" and "Variable2" with the actual variable names, but it says that it doesn't recognize "Bardatetime", and is an unknown variable.

for the offset line I'm trying to reference for my entries, I want to make a decision based off the current close if it was 26 bars back. I was having a problem with using the [26], because it would reference the close 26 days ago, not the current close 26 bars back. I'm not sure if this makes sense, but any help is much appreciated.

Thanks a lot!

Reply With Quote
 
  #10 (permalink)
Elite Member
Texas, USA
 
Futures Experience: Intermediate
Platform: X_TRADER Pro, Custom
Broker/Data: NxCore
Favorite Futures: Futures, Spreads
 
Hulk's Avatar
 
Posts: 215 since May 2014
Thanks: 509 given, 474 received



WPITrader View Post
For that print statement, do I have to make a new variable for the "Bardatetime", or should I put in the bar, date and time I want to check? and in what format? The only reason I ask is because when I copy in the code, I replace the "Variable1" and "Variable2" with the actual variable names, but it says that it doesn't recognize "Bardatetime", and is an unknown variable.

You must have an older version of tradestation. You should be able to use "Date" and "Time" keywords to print out Date and Time of the bar. Refer to the built in help for formatting syntax.


WPITrader View Post
for the offset line I'm trying to reference for my entries, I want to make a decision based off the current close if it was 26 bars back. I was having a problem with using the [26], because it would reference the close 26 days ago, not the current close 26 bars back. I'm not sure if this makes sense, but any help is much appreciated.

In general, variables in EasyLanguage are arrays. Using the [index] notation allows you to refer values calculated that many bars ago. Your best bet is to use the print function and debug this.

Reply With Quote

Reply



futures io > > > > > Confused about "Currentbar", using Ichimoku Cloud

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sal Starzun's Trading systems info on "Eclipse" and "Moon" Naples Trading Reviews and Vendors 2 January 7th, 2015 08:56 AM
Saxo Bank's 10 "Outrageous Predictions" For "2012: The Perfect Storm" Quick Summary News and Current Events 0 December 17th, 2011 08:10 PM
Fukushima: "China Syndrome Is Inevitable" ... "Huge Steam Explosions", or "Nuclear Bo Quick Summary News and Current Events 0 November 22nd, 2011 02:50 AM
How to change "Stop Loss" and "Take Profit" in "shElderImpulse" Strategy javed759 NinjaTrader 1 November 1st, 2011 11:44 PM
"mid", "buy", "sell" volumes lokgotkent Traders Hideout 6 September 30th, 2011 02:24 PM


All times are GMT -4. The time now is 05:23 AM.

Copyright © 2017 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 2017-12-13 in 0.16 seconds with 19 queries on phoenix via your IP 54.92.194.75