How to define the bar Index correctly?
Forums › ProRealTime English forum › ProOrder support › How to define the bar Index correctly?
- This topic has 8 replies, 4 voices, and was last updated 7 years ago by Bard.
-
-
04/06/2017 at 8:06 PM #31296
Hi,
I have code:12IF LONGONMARKET AND (BarIndex - TRADEINDEX) = 3 THENSELL 10 share AT MARKETBecause I haven’t defined the bar index I’m seeing trades exited as long as 10 days later so I’m wondering how do I incorporate the barindex part into this code?
(pls see screenshot)if I remove
1AND (BarIndex - TRADEINDEX) = 3it is half as profitable so I’m not sure what that line is doing to add to the profitability?
I’m hoping this isn’t going to be a D’oh moment…Thanks in advance.
04/06/2017 at 11:28 PM #31306Bar Index is the number of bars the System has been running and Trade Index is the Bar Index of the last trade.
So last Trade at bar #100 and it is now bar #103 so your Long will exit (3 bars after entry).
Note: I haven’t looked at screen shot or code in screen shot so if above is not what you need to know then just say?
If Longonmarket (10 shares?) and you want to exit then it is normal to say ‘Sell at Market’ (not sell 10 shares at market).
04/14/2017 at 10:37 PM #32071Cheers for the explanation Grahal,
If you have a moment to look at the screenshot you’ll see there are trades that have been held for 10 days instead of 3 days — (eg at the bottom of the detailed report table on the 24th Feb 2017). So I can’t figure how to make it exit after 3 days, hence I was wondering if I need some other bit of code to tell the system to start counting?04/14/2017 at 11:17 PM #32072Hi Bard
If you put the code up as code (not an image) then I could run it and check it out better.
But in the meantime Line 23 needs to read
Sell at Market (not sell 10 shares at market)
Whenever I’ve mistakenly put Sell * shares as an Exit I get an error message that it is not allowed? But I could check this out if I could run the code.
Also Line 22 should read (bar index – tradeindex = 3) … all within brackets (you have = 3 outside the brackets).
Apart from the above errors then as far as I can see the Trade should exit after 3 bars, but running your code on my Platform is the easiest way for me to get involved?
GraHal
1 user thanked author for this post.
04/15/2017 at 9:10 AM #32095Whenever I’ve mistakenly put Sell * shares as an Exit I get an error message that it is not allowed?
Yes, because by doing this, you ask ProOrder to close partial position, but it’s not possible as you know it.
04/15/2017 at 11:15 PM #32128Thanks Grahal and Nicolas, right, an incorrect bracket placement issue.
Do you know what an “X” means next to a trading system in the Indicators and Trading systems window? Pls see screen? A few have appeared next to systems and I have never seen x’s before today?
Also is there a way of colouring the line of one of the two indicators (so you don’t have to use a cursor / mouse over on the Graph to see which is which?
GRAPH insidebarlong
GRAPH insidebarshortCheers
Bard04/16/2017 at 5:54 AM #32133I think the X means that is the current one open in the window
Cheers Kasper
04/16/2017 at 6:04 AM #32134I am on the phone so I don’t if the coding section will work but you can colour the graph by
graph xxx coloured (134,231,150) as “xxx”
1 user thanked author for this post.
04/16/2017 at 2:42 PM #32187 -
AuthorPosts
Find exclusive trading pro-tools on