"Highest" function won't work with this code
Forums › ProRealTime English forum › ProOrder support › "Highest" function won't work with this code
- This topic has 14 replies, 3 voices, and was last updated 4 years ago by Finning.
-
-
11/28/2019 at 8:21 AM #113791
Was trying to get this to work:
123tradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)graph highest[barindex](tradedollars)Tradedollars works on its own – and I can graph it and it does what it should – but it won’t seem to graph the HIGHEST of this function.
Any clues why?
Thanks,
Finning
11/28/2019 at 8:40 AM #11379311/28/2019 at 8:44 AM #113795This sort of thing often happens to me – it is probably due to trying to find HIGHEST[0] when BARINDEX = 0.
Try this instead – not tested:
12345tradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)maxtradedollars = max(tradedollars,maxtradedollars)graph maxtradedollars11/28/2019 at 8:44 AM #11379611/28/2019 at 8:47 AM #113798Try this (not tested):
1234567tradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)if barindex > 0 thenmaxtradedollars = max(tradedollars,maxtradedollars)endifgraph maxtradedollars11/28/2019 at 8:53 AM #11379911/28/2019 at 9:06 AM #113802Hi Vonasi,
thanks for your reply.
I just tried your code, and it didn’t work either.
Putting the “graph” right at the bottom of the code too with nothing under it.
Just not returning anything, not even a zero.
A graph value line doesn’t even com up in the cursor details box.
11/28/2019 at 9:12 AM #113804Hi Vonasi,
just read your second code and tried it – the second code comes up in the cursor window as maxtradedollars – however the value doesn’t change from zero at any stage.
Nicolas,
I am currently running v 10.3 – 1.8.0_45
Thanks
11/28/2019 at 9:14 AM #113806But it should work! Proceed in order:
- use one of our snippet in another code (basic one) on the same instrument
- if 1/ doesnt work, try another instrument and timeframe
- if 2/ doesnt work, relaunch platform
- retry
- give feedback here
11/28/2019 at 9:32 AM #113808Hi Nicolas,
I can’t do everything right now – but I’ll give you some quick feedback:
I have been working on AUDUSD $1 weekly timeframe – where I have had my initial problem.
Just retried the complete code from #113798 on my initial code and I can confirm that it didn’t work – it only showed a zero the whole time.
So as for point #1
I tried this code below on my target market the AUDUSD $1 weekly timeframe
12345678910111213141516If date = 20000102 thenbuy 1 contract at marketendifIf date = 2000131 thensell at marketendiftradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)if barindex > 0 thenmaxtradedollars = max(tradedollars,maxtradedollars)endifgraph maxtradedollarsand I still got a constant zero value from the maxtradedollars graph – see attached picture.
I’ll work my way through the other points ASAP and get back to you.
Thanks,
Finning
11/28/2019 at 9:45 AM #113811It works for me for AUDUSD mini, not with AUDUSD .. with this code:
123456789101112131415If date >= 20020102 and not longonmarket thenbuy 1 contract at marketendif//If date = 2000131 then//sell at market//endiftradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)if barindex > 0 thenmaxtradedollars = max(tradedollars,maxtradedollars)endifgraph maxtradedollarsI’ll make a report.
11/28/2019 at 9:51 AM #11381311/28/2019 at 9:55 AM #11381411/28/2019 at 5:47 PM #113870The problem is identified and will be fixed. In the meantime, you can change the code with:
123456789101112131415If date >= 20020102 and not longonmarket thenbuy 1 contract at marketendif//If date = 2000131 then//sell at market//endiftradedollars = ((close/pipsize)*countofposition*pipvalue)-((tradeprice/pipsize)*countofposition*pipvalue)if tradeindex > 0 thenmaxtradedollars = max(tradedollars,maxtradedollars)endifgraph maxtradedollarsIt should work.
1 user thanked author for this post.
11/28/2019 at 11:52 PM #113889 -
AuthorPosts