Martingala

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #185350 quote
    axmichi
    Participant
    Senior

    Hallo,

     

    wäre es möglich mir den folgenden Code zu programieren. Ich möchte das wie bei Martingal Trading, nach einem Verlusttrade das Risiko für den nächsten Trade * 2 genomen wird

    Beispiel mit 100 $ Risk

    1. Trade  endet im Verlust

    2. Trade wird eröffnet mit 200 $ Risk. Endet der Trade im Gewinn geht wieder mit 100 $ Risk weiter – endet der Trade auch wieder im Verlust öffnet der nächste Trade mit 300 $ Risk

    Eendet der 3. Trade im Gewinn oder Verlust wird wieder ein normaler Trade mit 100 $ Risk eröffnet.

    Geht das zu machen?

    Vielen Dank!

    Hier der Code:

    ONCE Capital    = 10000  //10000€ initial Capital
    ONCE Investment = 5      //5%     max Investment for each trade
    ONCE MinLots    = 0.5    //0.5    min lot size (Dax)
    ONCE Margin     = 5      //5%     Margin required by the broker for each lot
    Invested        = Capital * Investment / 100 / PipValue
    CurrentMargin   = close * Margin / 100
    TempLots1       = Capital / CurrentMargin
    TempLots2       = round(((Invested / CurrentMargin) * 10) 0.5) / 10  //round to 1 decimal digit
    PositionSize    = max(MinLots,TempLots2)  //never below the minimum lots
    c1 = DayOfWeek=1              // Day of Week = Montag
    c2 = time=174500              // Buy on Monday at 17.45h Local Time Frankfurt
    TIMEFRAME(daily)              // Switch to daily chart candles
    c3 = close<average[34](close) // Close on Monday is below 34-Tg-SMA (daily-TF)
    TIMEFRAME(default)            // Switch back to default TF (5m or 15m)
    IF c1 AND c2 AND c3 THEN
       BUY Positionsize SHARES AT MARKET
    ENDIF
    exit1 = DayOfWeek = 3         // Exit on Wednesday at 09.00h
    exit2 = time=090000
    If LongOnMarket AND exit1 AND exit2 THEN
       sell at market
    ENDIF
    PCTgSL = 2.6
    set stop %loss PCTgSL
    PCTtp  = 2.3
    set target %Profit PCTtp
    //graph PositionSize
    #185355 quote
    robertogozzi
    Moderator
    Master

    Bitte starten Sie für jede Frage ein neues Thema, das keinen Bezug zu anderen bestehenden hat. Danke 🙂

    Ich werde es so schnell wie möglich überprüfen.

    #185366 quote
    axmichi
    Participant
    Senior

    Danke Ihnen

    #185538 quote
    robertogozzi
    Moderator
    Master

    Versuchen Sie dies, es scheint mir, dass es funktioniert:

    ONCE Capital    = 10000  //10000€ initial Capital
    ONCE Investment = 5      //5%     max Investment for each trade
    ONCE MinLots    = 0.5    //0.5    min lot size (Dax)
    ONCE Margin     = 5      //5%     Margin required by the broker for each lot
    IF (StrategyProfit = 0) OR (Not OnMarket AND OnMarket[1]) THEN
       Invested        = Capital * Investment / 100 / PipValue
       CurrentMargin   = close * Margin / 100
       TempLots1       = Capital / CurrentMargin
       TempLots2       = round(((Invested / CurrentMargin) * 10) - 0.5) / 10  //round to 1 decimal digit
       PositionSize    = max(MinLots,TempLots2)  //never below the minimum lots
       MainSize        = PositionSize
    ENDIF
    ONCE MainSize   = PositionSize
    ONCE LossSize   = MainSize
    IF StrategyProfit < StrategyProfit[1] THEN
       LossSize     = LossSize + MainSize
       PositionSize = LossSize
    ELSIF StrategyProfit > StrategyProfit[1] THEN
       PositionSize = MainSize
       LossSize     = PositionSize
    ENDIF
    c1 = DayOfWeek=1              // Day of Week = Montag
    c2 = time=174500              // Buy on Monday at 17.45h Local Time Frankfurt
    TIMEFRAME(daily)              // Switch to daily chart candles
    c3 = close<average[34](close) // Close on Monday is below 34-Tg-SMA (daily-TF)
    TIMEFRAME(default)            // Switch back to default TF (5m or 15m)
    IF c1 AND c2 AND c3 THEN
       BUY Positionsize SHARES AT MARKET
    ENDIF
    exit1 = DayOfWeek = 3         // Exit on Wednesday at 09.00h
    exit2 = time=090000
    If LongOnMarket AND exit1 AND exit2 THEN
       sell at market
    ENDIF
    PCTgSL = 2.6
    set stop %loss PCTgSL
    PCTtp  = 2.3
    set target %Profit PCTtp
    //graph PositionSize
    //graph StrategyProfit < Strategyprofit[1]
    //graph LossSize
    //graph MainSize
    #185614 quote
    axmichi
    Participant
    Senior

    Hallo,  danke Ihnen!!

     

    Ist es richtig, dass die Zeilen 13 – 20 allein  dafür verantwortlich sind, das diese Martingale Regel funktioniert?

     

    Ich möchte die Matringale regel nämlich auch bei einem Breakout system einsetzen, wo,  wenn das system ausgestoppt wird nach martingale gleich wieder ein Einstieg erfolgt!

     

    Danke

    #185620 quote
    axmichi
    Participant
    Senior

    Hallo

     

    wenn ich den code auf Aktien laufen lasse, werden trades ausgeführt

    Im Dax mini oder micro leider nicht? warum??

    #185630 quote
    axmichi
    Participant
    Senior

    Funktionier, hab das kapital erhöht!

    #185732 quote
    robertogozzi
    Moderator
    Master

    Ja, das sind die Zeilen 13-20, zusätzlich zu Zeile 11.

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

Martingala


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
axmichi @axmichi Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by robertogozzi
4 years ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 01/13/2022
Status: Active
Attachments: No files
Logo Logo
Loading...