Limit order hold with IOG true - MultiCharts | futures io social day trading
futures io futures trading

Limit order hold with IOG true
Updated: Views / Replies:683 / 2
Created: by cygneslim 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 100,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

Thread Tools Search this Thread

Limit order hold with IOG true

  #1 (permalink)
Elite Member
Edwardsville, IL
Futures Experience: Intermediate
Platform: Thinkorswim, Multicharts
Favorite Futures: ES, TF, DX, Stocks
Posts: 13 since Nov 2014
Thanks: 1 given, 3 received

Limit order hold with IOG true

In Multicharts, I'm having a problem getting a limit order to "stick" for more than one tick after sending, with IOG on/true. This is the same problem I've read about in a couple of other threads where the limit order is sent, cancelled, sent, cancelled, etc. after each tick. I have tried the suggestions but with no success.

I'm using a 1minute bar chart and trying to accomplish the following:
A. Evaluate OPEN tick of 1minute bar for buy or sell condition
i. Look back at the previous tick (closing tick of previous 1min bar) and compare to a variable to determine if buy or sell condition is TRUE
ii. If buy or sell condition = TRUE, then set buy or sell price to the calculatedprice variable
iii. Set "trade" variable to trigger a buy or sell in the trade execution routine.

B. Evaluate value of "trade" variable to determine if a buy or sell should be executed
i.Execute a buy or sell limit at buyprice or sellprice

I'm using the (barstatus(1)=0) code is so that the buyprice or sellprice, and the determination of whether to buy or sell, is set/made only once within the 1min bar and the condition will hold until next 1min bar open tick. This should prevent the constant submitting and cancelling of my limit order until executed. The problem is that even though the trade price is set and the trigger variable is set to buy or sell on the open tick of the 1min bar, the trade trigger variable still resets to zero on the next ticks outside of this "barstatus" routine. I'm not sure why this is happening since this part of the code should only be executed once in each 1min bar.

It seems like there is a simple explanation for this. Can anyone help with this? Example code follows:

[IntrabarOrderGeneration = True];

pricevar (0),
calculatedprice (0),
buyprice (0),
sellprice (0),
trade (0);

if (barstatus(1) = 0) then begin // evaluate opening tick of 1min bar
If close[1] > pricevar[1] then begin //compare closing tick of previous bar to variable
buyprice=calculateprice; //set buyprice variable to calculated price variable
print("O bar # is", maxbarsback+currentbar," ",close[1]," ",buyprice); //for debugging
trade = 1; //set a trade trigger variable for a buy
end else

If close[1] < pricevar[1] then begin //compare closing tick of previous bar to variable
sellprice=calculatedprice; //set sellprice variable to calculated price variable
print("O bar # is", maxbarsback+currentbar," ",close[1]," ",sellprice); //for debugging
trade = -1; //set a trade trigger variable for a sell
end else

If close[1] = calculatedprice[1] then begin //set a trade trigger variable to neutral - no trade

//Following code is to execute a buy,sell, or no trade based on value of "trade" variable. The price for the limit order
//has been calculated in the previous code and the trade trigger variable has been set in previous code.
//My assumption here is that neither variable should change until the opening tick of next 1min bar, however
//when I look at the output window the "trade" variable is 1 or -1 on the first tick after 1min bar opening tick, and for
//all other ticks it goes to zero/0. See following code.

if trade=1 then begin //buy next tick if trade variable=1
buy ("B1")next bar at buyprice limit;
print(time,"trade=",trade," ",buyprice); //for debugging
end else

if trade = -1 then begin //sell next tick if trade variable=-1
sellshort ("S1") next bar at sellprice limit;
print(time,"trade=",trade," ",sellprice); //for debugging

Reply With Quote
  #2 (permalink)
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,803 since Apr 2013
Thanks: 288 given, 1,085 received


variables should be of type intrabarpersist when they can change their value during the bar. It could simply be that they are not holding the values correctly in your code and therefore the code assumes you changed an entry condition and cancels or re-sends orders.
If this doesn't work, I would suggest getting rid of the barstatus = 0 and keep track of a new bar in the code yourself.


Reply With Quote
The following user says Thank You to ABCTG for this post:
  #3 (permalink)
Elite Member
Edwardsville, IL
Futures Experience: Intermediate
Platform: Thinkorswim, Multicharts
Favorite Futures: ES, TF, DX, Stocks
Posts: 13 since Nov 2014
Thanks: 1 given, 3 received

Many thanks ABCTG.

I really don't understand why this works yet, but it works. I need to study up on the why though.

I used a dummy code to test this and the variable that I am using to trigger the trade now holds it's value every tick until reset at the open of the next bar, which is what I've been trying to accomplish. I have more work to do but it's a big relief to have made some progress and you've saved me a lot of time.

For future reference for anyone who runs into the same problem, my solution was basically the following:


intrabarpersist tradetrigger (0);
intrabarpersist buyprice (0);


if *condition to buy is TRUE* then tradetrigger=1 and buyprice=*price*;

if tradetrigger=1 then buy next bar at buyprice limit;

Last edited by cygneslim; March 24th, 2015 at 06:03 PM. Reason: forgot to add intrabarordergeneration=TRUE to code
Reply With Quote


futures io > > > > Limit order hold with IOG true

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

September Journal Challenge (sponsored by TopstepTrader)


Battlestations! Win $947 in prizes for showing us your trading desk!


Finding Your Edge & Maximizing Returns w/Richard L Weissman

Oct 16

Similar Threads
Thread Thread Starter Forum Replies Last Post
Market order type better for futures vs Limit order? zx58 Beginners and Introductions 8 January 19th, 2015 02:56 PM
Programming another limit order if order isn't filled? ericson NinjaTrader Programming 5 January 28th, 2014 05:50 AM
ATM Strategy: Limit order & stop loss order at the same time in the market? DrE6 NinjaTrader 2 June 21st, 2013 01:12 PM
Time of Order Submission Limit Calculation / Conditional / Price Improvement Order CoopGeko IB Trader Workstation 0 September 17th, 2012 09:15 PM
IOG causing my limit order to cancel and replace intrabar tradersheldon EasyLanguage Programming 10 August 2nd, 2011 09:03 AM

All times are GMT -4. The time now is 12:07 PM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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 2018-10-15 in 0.11 seconds with 14 queries on phoenix