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)
Looking for Linear Regression Indicator code that display up and down trend
That's interesting to understand. So, I'm using 100 tick bars setup for the graph in my strategy, and it could be a problem beacause if in those 100 tick the price drop down more that the Stop Loss it can lost more since the stop order goes live.
Shall I simply set
to avoid this problem? Will, by this way, the system send the stop on takeprofit orders immediately after execution of the entry?
The problem is that I have an entry conditions(for example for LONG ENTRY) that has to open a position " at the close of the bar after the bar of the linear regression color change " ( basically at the close price of the bar after the bar with LINEAR_REG > LINEAR_REG[1]). So here I don't want it to be executed during intrabar time...
but of course I want se send IMMEDIATELY the SL e TP order even in intrabars....
Could it be a solution to set [IntrabarOrderGeneration = true] before the stop loss and take profit orders and then se it FALSE after that?
Can you help answer these questions from other members on NexusFi?
attributes like IntrabarOrderGeneration are global for your code, you can't switch them on and off or have it only work for a section within the same code. They would allow to issue the stop and target directly after an entry, but you can accomplish the same using SetStopLoss and SetProfitTarget.
So If I understood correctly the "trick" is simply to use SetStopLoss and SetProfitTarget. Both will be executed "REALLY" next tick (so intrabar) Even if for this strategy intrabar order generation is false.
On the other side, if in another stategy I'm going to use intrabar order generation TRUE, the orders below will be executed at the same time as they would be in the form of SetStopLoss and SetProfitTarget.
I would suggest testing it, so you can see for yourself. The reserved words SetStopLoss and SetProfitTarget can trigger the exits during the bar.
When using intrabar order generation the stop and target orders in your code would be placed as soon as the code detects the MarketPosition being +1 or -1.