Coin Toss Code Issue

Forums ProRealTime English forum ProOrder support Coin Toss Code Issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • #34425

    Hi All

    I know this is a big ask as it is a lot of code to wade through but hopefully someone might be able to spot the issue/provide some feedback as to what is wrong with my code below

    Basically I have all but given up on using any indicators/techniques for order entry and have decided instead to rely on the good old Coin Toss for order entry -> heads = buy tails = sell – then the majority of the strategy is how the trade is managed

    Sounds daft I know but strategies both in demo and live have been performing better than average

    The problem is that occasionally (after a week/couple weeks) and only some not all of the strategies will fail with the DEFPARAM/load more bars error and I cannot work out what is causing the problem – I’ve highlighted the part of code I ‘think’ is causing the problem but it is not using any indicators – it is only the random number generator that uses indicators and the ‘largest’ is the RSI[14] so 2000 bars is more than enough to load

    Difficult to go into all the details of how strategy is working but if there is any interest/feedback just ask away and more than happy to try and explain 🙂

    Cheers!

    Max

     

    #34429

    MYNUMBER should be less than 2000?

    #34455

    Thanks (as ever!) for a quick reply Nicolas

     

    I have no idea how you saw that and I don’t 100% follow as MYNUMBER could only ever be between 0 and 59 initially and then between 0 and 1 from then on but it got me thinking/realised some errors and have edited the code as follows

    I’ve deleted the ONCE MYNUMBER=CURRENTSECOND and added the *10 for MYNUMBER (no idea how this was working if for example MYNUMBER = 0.3!)  but I also noticed I was getting the occasional -0 for MYNUMBER so have added the ABS

    Maybe that was it… hmmm will test and get back if still happening – thank you again! 🙂

     

     

    (On another note Nicolas I see the code above is all left justified which implies/I have had this happen before when there are issues with missing/incorrect ENDIF statements – but I notice it happening more and more when it is code that is fine/I have run and which works and I cannot see any issue in the syntax of the code – when it happens I just CTRL-A -> CTRL-X -> CTRL-V and all the code is properly aligned but it makes me nervous that there is something wrong… wondered if you might know why it is doing that?)

    #34475

    It was just a rough idea while browsing different topics and because of

    .. I didn’t test the code, but did you GRAPH MYNUMBER already?

    About indentation of the codes … pfff what a mess, I already spent too much time trying to make it works, believe me I would be glad to have it sort out since the time I’m trying to get it through! The indentation is lost when you copy/paste from the platform IDE, you can try on notepad for example, that’s why my syntax highlighter would need to parse all the codes and rebuild it, but it is really painful to code 🙂

    #34510

    On an unrelated note it is good to see that someone found a use for my code snippet. I can also see that it can cause problems if you change parts of it.

    #34511

    Hi Wing yes thank you very much 🙂

    The only changes I made to your code originally was to add +1 to TIME as I had issues in testing months ago and thought perhaps it might be to do with when TIME = 000000 – dividing by 0 would be infinity/cause problems no?

    The other thing I changed was to divide the whole calculation by 10 so as to get results between 0 and 1 which I could then ROUND to give a definite 0 or 1 for the coin toss

    Nicolas – cool thanks I see how you spotted it now but am still bit confused as the highest MYNUMBER could be initially would be 59 (it’s run on 3 second timeframe) so 59*10=590 still nowhere near 2000 then after that it would be highest of 1*10=10 – anyway I have edited and will get some demo strategies up and running and see how we go

    Re: the code indentation issue I was meaning in the platform IDE itself when I open up a strategy – sometimes it’s all left aligned which makes me uncomfortable all is not quite right with the code – but totally understand the headache you must be having trying to get it formatting properly into the forums here – bigger fish to fry am sure/don’t worry about it 😉

    I’ve been running the strategy both in demo and live for a few months now and on the whole was doing quite well BUT fell foul of the age old problem of ‘getting carried away’ and having setup too many systems running in parallel (live) the first round French election Sunday ‘jump’ was not kind to me/I was foolish as it was obvious in hindsight too many strategies had ended up short on the Friday going into the weekend and yeh this/any strategy I think can not deal well with those kinds of gaps! 🙁 *ouch*

    Am attaching a screenshot to show how the strategy plays out/see if anyone might potentially take interest in wanting to know more/help out on the trade management side of things

    Cheers

    Max

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login