Helping with a code

Forums ProRealTime English forum ProOrder support Helping with a code

Viewing 15 posts - 1 through 15 (of 18 total)
  • #10962

    I need this idea translated to code if possible please?

    Short: 50 EMA crosses under 200 EMA,

    Price crosses over 50 and 200 ema

    short entry on pivot or R1 or R2 or S1 or S2….

    Also could I get for the long position too (see the second screenshot)

    I have attached the screen shot..

    Much appreciated

    Thanks

    1 user thanked author for this post.
    #10988

    COULD SOMEONE HELP, Please?

    #10996

    Hi Jon. There are some missing infos here. when do you want to exit your positions?

    Pivot what do you want , go short or long? It doesn’t make sense to say I want to go short and Long on Pivots. you need to be more specific. Anyway I made a simple code on the EMA200 and 50. it exits if the High or Low  on ema 50 touches the price again,  SL is set to 65. it should be easy to change the numbers. Unfortunately it doesn’t make any real profit- I tested it on 4H DAX.

    Cheers

    Kasper

     

    1 user thanked author for this post.
    #11010

    Hi Kasper,

    Thank you for making the code, much appreciated. Sorry, I didn’t make the idea more clear. Here is more thought-out idea…..

    Long position,

    50 Ema is over 200 EMA, then price crossed under EMA 50 and 200 and price equals pivot (this could be any of the R1, R2, S1 or S2 not just pivot level) (see the screen shot attached on first post) so entry is at Pivot.

    Stop loss can be set to 10 points, trailing stop 10 points, and target can be till price touches 50 EMA.

     

    Short Position,

    200 Ema is over 50 EMA, then price crossed under EMA 200 and 50 and price equals pivot (this could be any of the R1, R2, S1 or S2 not just pivot level) (see the screen shot attached on first post) so entry is at Pivot.

    Stop loss can be set to 10 points, trailing stop 10 points, and target can be till price touches 50 EMA.

     

    Thank you again for the help

     

    #11014

    Hi Jon, I’m sorry I cant make this code. My attempts to code this, don’t shows no orders. this means that either I’m doing something wrong or the conditions are never met.

    here is a the code for a simple test only for the Pivot line

     

    #11017

    The c3 condition seems a lot restrictive. You try to test if a high is absolutely equal to a pivot point. I didn’t read the strategy description though so I’m maybe wrong 😊

    #11020

    Hi Nicolas, and Thanks. I also found other errors, and I have some time to think it over, between diaper change and gardening 😊

    I will get back a bit later with something.

    #11022

    Hi Jon. This is what I came up with. Seems like there is not to many trades in the 2 years I backtested it on DAX 30 min chart. that is maybe a subject to discuss as I didn’t look further into this. does the number of trades seems legit, should there be more?

    It generates a small profit, but it closes the trades on the same bar. that means that we cant be sure if you were stopped out by SL due to limitation in backtesting with ProOrder. ProOrder only calculate profits on the same bar.

    Anyway it generates a small profit over the last 2 years.

    Cheers Kasper

     

     

    #11026

    more scrndumps

    #11042

    Kasper, thank you very much for taking out your time to provide me with the code.

    I think it should have provided more than 44 trades in few years but this probably to do with limitation PRT rather than your code. But how easy would it be to transfer this idea and code you provided me into screener, which prehaps I manually enter position if the setup is correct?

    thanks

    #11047

    Hi Jon.

    Well It should be no problem to convert the code to both an indicator and a Screener. I think it also will be a good time to test if all S and R lines will be used. I changed your strategy a bit so when you have a retracement towards the Pivot, S and R lines, I test for the next candle actually bounces off and not going through. I think this gives a better strategy in terms of automatic trading. I will see how it turns out in a screener. But I’ve just returned to work from summertime so I can’t say when it will be finish.

    Cheers Kasper

    #11050

    Kasper, no problem any time it suitable to you! thank you!

    #11064

    Hi Jon. I need to solve this problem. When I add Pivot indicators on price it’s only the current day it will display. If I need to verify your strategy with the actual code, I need the history of those lines in the chart. Otherwise I can’t see if I’m on the spot or not. It may be a simple issue, but in fact I started coding just a few weeks ago so many things are still new to me 🙂  I will try and ask in the community.

     

     

    #11065

    Ahh never mind, I think I found another Indicator that does what I want 🙂

    #11072

    Hi Jon. It was actually easier that expected. I have made both the screener and indicator. The code has change a bit in the structure, but they are the same. The indicator together with the backtest of the code will give you an idea when conditions are met. I still can’t verify if the code is in consistent with you requirements, so I guess you have to verify it, by looking at the results.

    Further what the backtest shows, I wouldn’t put my money on as the issue with PRT and profit on zero bars is still an issue. PRT will only count the winnings and not the losses, unless there are no winners within the one bar of testing.

     

Viewing 15 posts - 1 through 15 (of 18 total)

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