NexusFi: Find Your Edge


Home Menu

 





Close a position in Range Bar at specific time


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,687 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Close a position in Range Bar at specific time

  #1 (permalink)
ewind
Hong Kong
 
Posts: 4 since Aug 2015
Thanks Given: 0
Thanks Received: 0

My strategy is based on range bar chart. How can I close a position at a specific time, such as 10 minutes before market close, in which the range bar may not completed at that specific time? I have tried turning on the intrabarordergeneration and added a time chart as subchart as data 2, but still no luck.

Appreciate with your help.

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Request for MACD with option to use different MAs for fa …
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
67 thanks
Battlestations: Show us your trading desks!
48 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


ewind,

you don't need a second datastream, but it does require intrabar order generation. For historical exits you can use the bar tick by tick timestamp that you can access, but for realtime exits you'll have to use your computer clock.

Regards,
ABCTG


ewind View Post
My strategy is based on range bar chart. How can I close a position at a specific time, such as 10 minutes before market close, in which the range bar may not completed at that specific time? I have tried turning on the intrabarordergeneration and added a time chart as subchart as data 2, but still no luck.

Appreciate with your help.

Thanks


Follow me on Twitter Reply With Quote
  #4 (permalink)
ewind
Hong Kong
 
Posts: 4 since Aug 2015
Thanks Given: 0
Thanks Received: 0

Dear ABCTG,

I am new to easy language therefore I hope you don't mind my stupid questions.

Historical Exits: -> Would you elaborate how to access the tick timestamp?
Realtime Exits: -> I guess I can use currentTime instead of time in my coding. However, is that mean I have to switch currentTime/Time between backtest/SA?

Here is how the code look like for single datastream:

condition1 = Time >= CalcTime(SessionEndTime, MinBeforeClose ) and Time < SessionEndTime;

if condition1 then
if marketposition(0) = -1 then
buytocover next bar at market
else if marketposition(0) = 1 then
sell next bar at market;


Thank you very much.

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

ewind,

check out this link:
https://www.multicharts.com/trading-software/index.php/Bar_Magnifier

You can let the code detect if it's currently historical data or realtime data. Check out LastbarOnchart and airealtimecalc for example to accomplish this.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
ewind
Hong Kong
 
Posts: 4 since Aug 2015
Thanks Given: 0
Thanks Received: 0

Thanks ABCTG. After further study, I find that my original code works for real time exit, but the actually exit time is different from what it shown in performance report.

For historical exit, I turned on the "Enable access to intra-bar time...", it seems returning what I expected (sometime still close session in next day, very strange), although it take much much longer to complete the back-test.

Thank you very much

Reply With Quote





Last Updated on January 26, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts