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.
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.
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 10:09 PM.
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?
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 "" suffixed to the variable name or "" 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 , 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.