martingale, need little help

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #24405 quote
    JohnScher
    Participant
    Veteran

    tested only dax

    #24406 quote
    Raul Vg
    Participant
    Senior

    Your code is From 6 in the afternoon of Tuesday to 9 in the morning of Thursday, would not it be better from 9 in the morning of Tuesday to 6 in the afternoon of Thursday?

    #24407 quote
    JohnScher
    Participant
    Veteran

    you wrote

    Your code is From 6 in the afternoon of Tuesday to 9 in the morning of Thursday, would not it be better from 9 in the morning of Tuesday to 6 in the afternoon of Thursday?

     

     

    …. No! i tested all timeconstellations, timeframe 1 H und timeframe 4 H

    these times i use bring the best results in backtest

    #24408 quote
    JohnScher
    Participant
    Veteran

    you wrote

    “that lot size are always rounded up to the next whole number so you’ll never get the exact same profit/loss in money than your last trade, is it a problem?”

     

    Whats that?  the whole is like from 1 to 2 positionsize? and not from 1.1 to 1.2 ?

    i understand correct?

    #24459 quote
    Nicolas
    Keymaster
    Master

    Whats that? the whole is like from 1 to 2 positionsize? and not from 1.1 to 1.2 ?

     

    Yes, this is correct, lot/contracts are always round number, so doing calculation to get the same gain in money with the same points objectives is almost impossible.

    #25509 quote
    JohnScher
    Participant
    Veteran

    So we have to work with this fact. Only the infinitely money must be more. No problem whatsover.

    Can you code? please?

    the code will be used as an example/code base/compenent

    
    // OriginalTrade without martingale, with positiv results in prt backtest 4H german 1 Eur mini
    MA1 = Average [1]
    MA2 = Average [2]
    c1 = Ma1>MA2
    
    t1 = time = 180000
    t2 = time = 090000
    
    d1 =dayofweek = 2
    d2 = dayofweek = 4
    
    If   d1 And t1 and c1 THEN
    buy 1 Contract At Market
    Endif
    
    
    If d2 and t2 then
    sell at market
    endif
    
    Set Stop PLoss 60 // from Trade
    Set Target PProfit 150 // from Trade

     

    And now the martingale to integrate (not correct code lines, sure, i m absolute beginner, hope you can understand what i want to use)

    // work with 10 contracts (lots) // to clear nearly the-round-number-problem

    Set Sop PLoss 600

    Set Target StrategyProfit  = 1500 points

    at first Set StrategyProfit = 0

     

    If after first trade strategyprofit <0 then// (example: after first trade = – 60 with 1 contact, – 600 with 10 contracts set positionsize new

    = corrrect postionsize to get: the Target StratgegyProfit + the loss from first trade (1500+600) then start trade again

     

    If second trade loss so do again find correct positionsize to get : the Target StratgegyProfit + the loss from first + loss from second trade (1500+600+600) and so again again until

     

    IF StrategyProfit = 1500 or StrategyProfit = – 1500 Then

    Quit

     

    Can you code this?

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.

martingale, need little help


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JohnScher @johnscher Participant
Summary

This topic contains 20 replies,
has 3 voices, and was last updated by JohnScher
9 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/05/2017
Status: Active
Attachments: No files
Logo Logo
Loading...