Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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.
Can you help answer these questions from other members on NexusFi?
Option 1: Store your condition true bar number in a variable:
Option 2: Look back on the entire condition
Option 3: Store true/false condition in a boolean variable
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.
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?
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.
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
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
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.
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
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.
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.
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.
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
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.