Coding required – Trade on specific day only via parameter

Forums ProRealTime English forum ProOrder support Coding required – Trade on specific day only via parameter

Viewing 10 posts - 16 through 25 (of 25 total)
  • #243292

    hi,

    that’s great – many thanks for coming back to me. my coding is very basic so i will need time to test this but really appreciate you sending over the code.

    regards

    #243456

    HI Roberto,

    ok, the array tables have been a game changer for me and work perfectly and I now have all 5 trading days with different parameters all working – so a massive thank you.

    in addition, I have managed to get the code working for opening a trade from a specific time for a specific day (using the ‘TimeRef = OpenTime’), so again – thank you, but I can not manage to get a trade to close at a certain time for a specific day.

    I do have a ‘DefParam FlatAfter’ that works very well in the main code but that closes trades at that one specific time for every day and I still would like the ability to close trades on different days at different times.

    I have tried all the suggestions above but none seem to work – anymore suggestions?

    thanks in advance

    #243457

    I only can suggest what I posted at https://www.prorealcode.com/topic/coding-required-trade-on-specific-day-only-via-parameter/#post-242966.

    I can’t understand whythe version to open a trade works fine, while the verskion to close a trade doesn’t. What’s different between the two cases?

     

    #243468

    Hi Roberto, hello Oggy,

    The difference will be that no code was provided for the task of closing :

    https://www.prorealcode.com/topic/coding-required-trade-on-specific-day-only-via-parameter/#post-242934

    So Oggy, you must copy the snippet as provided by Roberto in that post, change all the TimeRef references in that snippet o TimeRefClose, change all the tdx variables to tdClosex variables, make a tdCondClose variable for it (instead of tdCond) and use that as the condition for closing.
    Make the time span for closing small, like a startT of 204500 and endT of 210000 (a 15 minute time span).

    Does that help ?
    Peter

     

    #243472

    many thanks Roberto and Peter for coming back to me,

    i will try and resolve using the new suggestions, thank you, and revert but my coding is very basic so i may have to ask for the actual code as i can probably amend to make it work but not overly confident i can write it from scratch.

    thanks

    #243473

    ok so the change to close does not work at the moment but i am possibly/probably doing something wrong.

    I am no expert but could it be that the opening time of a trade has a reference in PRT which makes it easy to define –

    ie. TimeRef = OpenTime ( I assume in PRT code language that OpenTime does exactly what it says on the tin)

    so I think the closing of a trade doesn’t work because I can’t find a PRT definable reference for Closing a trade

    so I feel like I need specific parameter code for both Open – as previous – and then additional code for closing a trade at a certain time

    does that make sense?

    or am I barking up the wrong tree?

    thanks in advance

    #243476

    This example works like a charm:

     

    #243486

    Hi Roberto,

    thanks for that code, appreciated as always, but that doesn’t work for me unfortunately. I tried manipulating it for my code and that didn’t work and then i tried copying the whole code into a blank workspace and that didn’t work either.

    taking a step back, i have 2 issues;

    1. the opening of a trade works using a from time but not within a range such as:
      1. example “td2         = 1 AND DayRef = 2 AND TimeRef >= 110000 AND TimeRef <= 160000 //Tue  EXCEPTION”  – it opens a trade using the first TimeRef , ie after 110000, but ignores the second TimeRef – therefore continuing to put trades on all day.
    2. I would like specific code to close a trade at a certain time per day.

    any other advice or suggestions?

    Thanks in advance

    #243716

    Post the code you are using, specifying:

    • the timeframe used
    • the instrument or asset traded
    • date and time of a trade enterd or exited incorrectly.

    If you are using my code, just tell me, but post your version in case you modified it even slightly.

     

     

    #243790

    Hi Roberto,

    thank you for all your help – your code worked, I had implemented it incorrectly. I have now fixed it.

    thank you so much for all your help, and patience.

    regards

     

    1 user thanked author for this post.
Viewing 10 posts - 16 through 25 (of 25 total)

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