Enter on CalOnBarClose=True, but Exit Immediately on X Ticks (Page 3) - Traders Hideout | futures.io
futures.io futures trading
 

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Traders Hideout


Enter on CalOnBarClose=True, but Exit Immediately on X Ticks
Started:September 13th, 2016 (05:30 PM) by albertjay Views / Replies:730 / 22
Last Reply:October 18th, 2016 (09:16 PM) Attachments:0

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike
     

Reply
 
Thread Tools Search this Thread

Enter on CalOnBarClose=True, but Exit Immediately on X Ticks

Old September 22nd, 2016, 10:41 PM   #21 (permalink)
Trading Apprentice
Denver CO USA
 
Futures Experience: None
Platform: NT, JForex, Mql4 & 5
Broker/Data: FXCM
Favorite Futures: Forex
 
Posts: 23 since Sep 2016
Thanks: 0 given, 8 received

SpinnyBobos suggestion of using OnMarketData seems to be the way to go, unless you need to backtest.

Just curious why do you not want to use CalcOnBarClose = false ?

Thanks.

Reply With Quote
     

Old September 22nd, 2016, 11:42 PM   #22 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 47 received


maryfromcolorado View Post
SpinnyBobos suggestion of using OnMarketData seems to be the way to go, unless you need to backtest.

Just curious why do you not want to use CalcOnBarClose = false ?

Thanks.

for me, using OnBarClose = false becomes problematic when you need values for each bar from things.

I don't know how it is with using indicators like SMA or stochastics and stuff, but if you use

 
Code
protected override void Initialize()
{
      CalculateOnBarClose = false;
}
protected override void OnBarUpdate()
{
    if (FirstTickOfBar)
    {
         if (Close[0] > someValue)
           // do something
    }
}
Unless there is a different way that I don't know about, I am thinking this is how you would normally get around using OnBarClose = false through using FirstTickOfBar

When you compare using the same exact logic with

 
Code
protected override void Initialize()
{
      CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
     if (Close[0] > someValue)
        // do something
}
they don't always give the same values. Therefore if your strategy is heavily reliant on things being exact with data values, then it makes sense to use OnBarClose = true

If you have to backtest something, just

Add(PeriodType.Tick, 1); // to Initialize()

just make sure you download the data first before you load the chart so it does not take forever to load.

Reply With Quote
     

Old October 18th, 2016, 09:16 PM   #23 (permalink)
Trading Apprentice
Denver CO USA
 
Futures Experience: None
Platform: NT, JForex, Mql4 & 5
Broker/Data: FXCM
Favorite Futures: Forex
 
Posts: 23 since Sep 2016
Thanks: 0 given, 8 received


Yes, definitely looks timing related (FirstTickOfBar vs OnBarClose), as Close[0] changes with every tick. I will keep that in mind, but for now I have given up on NT, as support couldn't answer my questions on unmanaged strategies. The big issue is they have no Order.Close function like every other trading language I''ve used. And the only strategy they could point me to as an example is CamarillaPointsUnmanaged. One, when ran in real mode it bombs with an order reject. And two, it stops out or hits profit target. That's the only way to get out of the order.

If I missed something, I would love to know how to close an order. I entered a reverse BuyToCover or Sell to get out and sometimes it works, and sometimes it opens up new positions.

Thanks.

Reply With Quote
     

Reply



futures.io > Futures Trading, News, Charts and Platforms > Traders Hideout > Enter on CalOnBarClose=True, but Exit Immediately on X Ticks

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

NinjaTrader 8: Features and Enhancements, Tips and Tricks

Dec 6
 

Al Brooks: Stop Losing when a Good Trade goes Bad, Correcting Mistakes

Elite only
 

Trading Technologies: Algo Design Lab hands-on

Dec 13
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter and Exit market using different chart resolution vhanded MultiCharts 0 May 1st, 2015 06:37 AM
Enter and exit positions within the same bar mandelmus EasyLanguage Programming 2 March 12th, 2015 10:41 AM
How to enter long buy on a bar immediately before it closes. bmtfken EasyLanguage Programming 19 July 27th, 2014 08:01 PM
Best Price Enter/Exit? NJAMC Elite Automated NinjaTrader Trading 3 July 8th, 2011 06:00 PM
Viper has a "order entry strategy" that you can use to enter and exit. rcr3908 NinjaTrader 2 April 30th, 2011 06:20 PM


All times are GMT -4. The time now is 07:52 AM.

Copyright © 2016 by futures.io. 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 2016-12-08 in 0.08 seconds with 25 queries on phoenix via your IP 54.166.112.64