Code for different times and sequential positionsize.

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #107089 quote
    Fran55
    Participant
    Veteran

    Let’s see, Nicolas and Vonasi …

    we start from 0. I need parts of a code.

    1. I want to operate with several schedules. for example, from 10:00 a.m. to 11:00 a.m. and from 3:00 p.m. to 4:00 p.m. In addition, I want, for example, that from 10:00 a.m. to 11:00 p.m. it operates at € 1 pip and from 3:00 p.m. to 4:00 p.m. it operates at € 2 pip. So far what I have is that some operations overlap because the previous ones are still open, and the following are not performed. I have tried with true cumulateorders but the results are not the same. I want these operations to accumulate so that I can have several open.
    2. I want that if, for example, the first operation is € 1 pip, the next one is € 2 pip, and the next one is € 3 pip, and so on, regardless of whether operations win or lose.

     

    At the moment nothing more, I think. Thank you!!!

    #107090 quote
    Vonasi
    Moderator
    Master

    Fran55 – For some reason you embedded your text in a PRT code box and it was virtually unreadable.  I have taken some time to tidy it up. Please try to be more careful when posting. 🙂

    #107091 quote
    Vonasi
    Moderator
    Master

    The easiest way to do what you want and not have positions overlapping is to just run several versions of the the same strategy.

    This is a problem that a lot of traders don’t even realise happens. You create a strategy and the equity curve looks great but it opens a position on candle number 1 and holds it open for several candles. While the position is open you are missing out on other possible trading opportunities. Perhaps if you took them all the average equity curve and strategy performance might be awful but because you start at candle 1 you lucked out on a good equity curve out of all the possible ones. If you’d started at candle 2 then you might have ended up with an ugly equity curve.

    This is why I wrote my ‘Robustness Testers:

    Strategy Robustness Tester

    Actually coding something that opens all possible positions and then individually manages them would be very complicated. Best just to run several simple strategies along side each other.

    #107092 quote
    Fran55
    Participant
    Veteran

    Yes, i think =… Open separated time strategies.

    But the problem of this, is the point 2… If the next, and Next, and next operations accumulate more positionsize and i separated time strategies the results no are exponentials.

    I need  the first point.

    #107096 quote
    Fran55
    Participant
    Veteran

    I separated different times manually, and the results are 90% win trades with 200000k.

    No problem with the equity curve.

    #107105 quote
    Vonasi
    Moderator
    Master

    I’m afraid that I am struggling to understand your request.

    #107107 quote
    Fran55
    Participant
    Veteran

    Ive  tried some formulas but they dont world for me…

     

    Example:

    If ay one time It males 30 good and 3 bad and Another time It makes 50 good and 10 mad, when tOgether both chedules The results is 60 good and 13 bad, because of the good 80 some overlap And only 60.

    #107108 quote
    Vonasi
    Moderator
    Master

    I still do not understand what you are saying and all the mistyping, capital letters in the middle of sentences and incorrectly typed words are not helping. Perhaps less speed and reading your replies before clicking ‘submit’ might help. 🙂

    I’ll let someone else see if they can understand what you are asking for.

    #107115 quote
    Fran55
    Participant
    Veteran

    Sorry boys… Is for traductor, is bad.

     

    Im going to work… But tomorrow i Talk.

     

    Sorry.

    #107294 quote
    Fran55
    Participant
    Veteran

    Explications… See please.

    I created one strategy.

     

    If i separate hours in different strategies, 10:00 to 11:00 trade 10 good operations, 14:00 to 15:00 trade 15 good operations and 3 bad operations, 17:00 to 18:00 trade 12 good operations and 1 bad operations.

    But if i no separate hours in different strategies the result of trades are 29 good trades and 4 bad operations.

    Missing 8 good trades… Because they overlap.

     

    I need what in one only strategie accumulate this missing 8 operations.

    #107298 quote
    Vonasi
    Moderator
    Master

    …and so we are exactly back at my original answer. Use multiple strategies then one strategy does not stop another from opening any trades and you get all the trades. You just don’t get to see them all in one equity curve.

    Code for different times and sequential positionsize.

    #107315 quote
    Fran55
    Participant
    Veteran

    Yes, but im each i would like to add more position size.

    Exponentially It is not the same about the strategy with 500 operations than on several strategies with 20 operations in each.

     

    If add 0.10€ pip in strategy with 500 operations, finally operation as to 50€ pip.

    But if add 0,10€ pip on several stretegies wich 20 operations, finally operation as to 2€ pip.

    I want and need to do all operations on only one strategy.

    #107328 quote
    Fran55
    Participant
    Veteran

    And i need too the code to operate with more positionsize on the nexts operation.

    Example.

    First operation 1€ pip

    Second operation 2€ pip.

    3€… 4€… 5€…

    #107332 quote
    Vonasi
    Moderator
    Master

    Then you have to code a strategy that is able to control the positions opened in each time frame independently which will be a coding nightmare and possibly even impossible and not something that I would personally even try to attempt.

    Another option is to create an indicator for each period that simulates the trades in that period. You then have a strategy for each period and they then CALL all the indicators and check the simulated profit/loss levels of each and adjust position size accordingly. There is the issue that no simulated strategy in an indicator will exactly match live trading due to differing spreads and slippage – and even slightly differing start times can put it all out of sync.

    Another option is to run multiple strategies and just stop them occasionally and relaunch them with a new minimum stake and equity level for their own position size calculations. not ideal but certainly a lot easier than either of the other two options!

    #107339 quote
    Fran55
    Participant
    Veteran

    Ok… Uff… Is difficult.

    I am not a programmer, but i Will try.

    And the code to operate with more positionsize on following operations… Please.

     

    Example:

    Start with 1€ pip.

    Following operation 2€ pip.

    Next 3€,and so on…

    Next 4€, next 5€, Next 6€

     

    Thanks!

Viewing 15 posts - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.

Code for different times and sequential positionsize.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fran55 @fran55 Participant
Summary

This topic contains 19 replies,
has 4 voices, and was last updated by Juan Salas
6 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/10/2019
Status: Active
Attachments: 3 files
Logo Logo
Loading...