NexusFi: Find Your Edge


Home Menu

 





Close a position in Range Bar at specific time


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
The Feds Stagflation Trap -- Negative Payrolls, $91 Oil, …
Traders Hideout
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
$134M Ground Entry Contract in Disputed Final Review Aft …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
22 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


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 X 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,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

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 X 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


© 2026 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 - Downloads - Top
no new posts