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 -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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
Can you help answer these questions from other members on NexusFi?
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.
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;
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.
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.