Code not executed at the given interval

Forums ProRealTime English forum ProOrder support Code not executed at the given interval

Viewing 15 posts - 1 through 15 (of 16 total)
  • #213065

    Firstly my appreciation for this Prorealtime software. I am not a programmer, but I was able to learn and code so easily. Amazing stuff.

    I wrote a code. The idea is to attach to 1 minute candle, so it execute at every minute. But the code is not getting executed at every minute, but at different interval. Sometimes I could not understand the logic when it gets triggered. What am I doing wrong. This is the simplest martingale code checking the previous candle . There are infact 3 issues. Please help me. Kindest regards.

    1. The Code doesn’t get executed at every minute as expected
    2. I donot know why After 1,2 the ordersize goes to 8
    3. The Code checking the CurrentMinute doesn’t work. I thought I will buy at 1 minute and sell at 59th minute.

     

     

    #213067

    You can also see in this screenshot.. When the existing candle is moving same as previous candle, the code is not triggered at all

    #213085

    Code is read one time at candlestick Close and order is launch at next open. So a visual decay is observed and you might get lost on this.

    Also, to open a SHORT position, use SELLSHORT instruction. SELL keyword is to close a long (BUY) position.

    1 user thanked author for this post.
    #213086

    Dear Nucolas,

    Thanks for the response.

    Even in that case, the execution should be at the end of every candlestick. How come it misses out on many candles. Also apart from  non execution, the lotsize also is different and not martingale as coded.

    I have used SELLSHORT when I donot find any long position. Refer the last sell line.

    #213107

    All the Orders below will just trade at the start of each new bar as there are no conditions attached to the Orders so they always be True so they will always Trade?

    Unless I have missed something?

     

    #213108

    Unless I have missed something?

    Yes you have GraHal  … I just spotted the If Bearish / If Bullish Conditions higher up your code.

     

    #213109

    Yes Grahal, I have a bullish or bearish check.

    But as per Nicolas, the code will be executed at the end of the candle stick. My problem is that the execution doesn’t happen for every candle as shown in the attachment. The lotsizes doesn’t increase as double, but 1,4 and sometimes 1,2,8.Moreover the syntax “CurrentMinute” variable doesn’t work.

     

    Do you see the reason?

    #213111

    “CurrentMinute” variable doesn’t work.

    The code in your OP, shows both references to CurrentMinute as // commented out, but I guess you know that?

    So If CurrentMinute = 1 (end of bar) then Orders would be executed in CurrentMinute = 2 (at open of next bar) … are you taking this into account?

    #213112

    sometimes 1,2,8

    Have you investigated if the missing ‘4’ was an exit ordersize (as you use ordersize in your exits alsso)?

    #213156

    I commented because it didn’t work. I gave for 59th minute and 1st minute.

     

    There was no 4 in exit or entry, it just jumped to 8 or sometimes 16. I think it all had to  do with the non execution of this code at every minute which is a basic problem.

     

    1. The code must get triggered at every candle, but it doesn’t.
    #213159

    From Line 22 to Line 29 at every bar you check if Long then Sell, If Short then Buy … there seems not much chance for any trade to accumulate profit?

    What Timefame  does the System run on?

    Have you tried using below, at the bottom of your Code, so you can easily see when trades are triggered …

    GRAPH LongTriggered
    GRAPH ShortTriggered

     

     

    1 user thanked author for this post.
    #213169

    The idea is to trade at 1st second and close at the 59th second.

    Trade depends on previous candle bring bullish or bearish.

    1) the code must get triggered every minute which is not happening

    2) the martingale logic not working.. Donot know why as it seems right. This also could be tagged to previous one

    3) CurrentMinute didn’t work so commented out

    The code 22 to 27, I had vide this way because current minute is not working  and I had to close any open position before I buy or sell for this current candle

    Thanks for your help and guidance.

    I have little experience in coding..

     

    #213170

    Also I was wondering there was no way to display a variable..

     

    I will try Graph command.. Thanks

    #213192

    Tried Graph command, I get error “The instruction Graph is not allowed for automated trading”

    #213193

    GRAPH enables variables etc to be monitored during backtesting.

    Comment out GRAPH for AutoTrading //GRAPH.

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

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