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)
New to Tradestation/EasyLanguage, it's only bee a week or so.
I'm trying to develop a strategy that places a limit order when a strong candle is formed at the high/low of the bar prior to the strong candle. I've been searching around for a way to deal with the fact that limit orders are cancelled at the end of the "next" bar.
To remedy this, I'm attempting to create an indicator that plots a horizontal line using the following logic:
If we have a "strong" up candle, draw line (place limit order) at the high of the bar prior to the "strong" candle.
If we have a "strong" down candle, draw line (place limit order) at the low of the bar prior to the "strong" candle.
As a side note, I've noticed that when I try to use "is_big_bar" in the if statement that plots the lines, it reacts differently to when I place the formula.
The problem is that these lines are sloped, rather than horizontal. Can anyone point me in the right direction, whether how to just have the limit order exist without getting cancelled, or with the indicator?
Can you help answer these questions from other members on NexusFi?
for drawing lines you might want to look into trend lines or horizontal lines. These are drawing objects and will do what you have in mind.
In general orders are cancelled when your conditions for the order are no longer true. You can use this to keep your orders alive by using conditions that you keep valid as long as you want.
You can for example use a Boolean variable that you set to true when your conditions are fulfilled and then only use this variable to issue your order. When you are filled or when you don't want to issue the order anymore you could set this variable back to false.
I've tried a million things over the last several days and am back to trying to plot horizontal lines, assuming I'll be able to reference them in the code for the strategy (not sure if that's possible).
Can't share the link because I only have 2 posts, but I found some info about drawing lines.
I've tried to plot a simple line to see how that works, but I am definitely doing something wrong.
you don't have to add your drawing to DrawingObjects on every code cycle. It is enough to add it when you create the drawing object. With the way you wrote the code you might also run into an error when myLine is still null and the code tries to add that to DrawingObjects.