need help coding simple D open strategy

Forums ProRealTime English forum ProOrder support need help coding simple D open strategy

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

    Hi, could anyone help out coding this strategy found on forexfactory: https://www.forexfactory.com/thread/1032108-dos-daily-open-strategy-easy-to-trade-simple

     

    here are conditions:

    • If difference in pips between Open to Close (or Close to Open) of previous daily closed bar is more than 110 pips, then at the open of current day – open a market order to the opposite direction of previous day.
    • i.e: if yesterday’s daily bar is Bullish (moved up) and BODY (Close price – Open price) is more than 110 pips, then today at the Open of new daily bar, at 00:00, open Sell market order.
      Note: if spread at midnight is too high (more than 4.0 pips) – Don’t open a trade yet. Wait with market order till spread narrows back. It may take even 1-2 hours but usually it will take only a few minutes. So once spread is less than 4.0 pips, open the trade.
    • TP = 20 to 50 pips, depends on currency’s volatility.
    • No SL.
    • If price goes from last entry against the direction of the trade, open at the Open of every new day an additional market order with same lot size as original trade. No TP for additional trade.
    • Close all trades together when sum of all open profitable and losing trades (“basket“) is positive (may be 0.1$ or 1$).
    • Instead of SL: If sum of all open trades (“basket”) is losing more than 25% of account balance – close all trades. *This may happen once in a decade if at all.
    #150167

    It’s not possible to know what the spread is, usually pretty high around midnight.

    What TF do you plan to use?

     

    #150186

    yes, i understand that, dont mind the spread for now. Planing on using daily tf 🙂

     

    thanks for fast answer

    #150201

    There you go:

     

    1 user thanked author for this post.
    #150247

    you are the best! thanks roberto

    #150256

    tried adding long conditions as well, but then it does not take any shorts… could you help me with that as well? 🙂

    #150268

    This should do (not tested):

     

    #150295

    thanks!! long and short short, long does not scale up though, and the panic 25% of capital SL does not seem to work

    #150300

    Adjust Capital to the actual size.

    #150331

    still, code does not sell ALL pos as soon as in profit. You can see in picture that it does sell each individual trade when in profit. Is it possible to ALL open shorts when trade is in profit. In the example in the picture, it should probably have been 7 contracts before reaching BE, but after 5 it sold some and bought some

    #150334

    Individual SL’s and TP’s are sent each time a position is added, so every position has it’s own life, if one hits the target or the stop loss it’s closed and POSITIONPERF is updated, so there’s no way to know the whole profit until ALL positions are close (that’s the time STRATEGYPROFIT is updated, not earlier).

    Managing accumulation of positions is not easy and, unless there’s only one global TP or SL, it’s impossible to know exactly what the performance is, since some positions may still be opened and some may have already been closed.

    But I have spotted a missing line, add this line just AFTER, or BEFORE, line 21:

     

     

    1 user thanked author for this post.
    #150338

    oh okay, i see. Do you know why strategy does not increase long positions? I have capital and initial capital the same.

    #150341

    Try removing AND Not OnMarket from lines 9 and 14.

    #150362

    Does not work :/

    #150376

    This should match the requirements (I made numeric values variable):

     

    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