Trading System with 2 contracts.....

Discussion in 'Strategy Building' started by Shax, Dec 2, 2020.

  1. Shax

    Shax

    Hi,

    I read in a book and also in an issue of Futures Truth magazine, that using 2 contracts instead of just one, the Equity Line can improve by becoming more regular;

    therefore, I wanted to ask if someone can help me to insert in this Trading System 2 contracts, but the first contract will close in profit after 100 points (or + 0.45 % from the entry price),
    while the second contract will follow the T.S. rules.

    I thank you in advance.

    ------------------------------------------------------

    Inputs: Length(50), len2(4), len3(4), Amount(1700);

    vars:
    daysintrade(0),atr(0),ptargmult(1),longliqpt(0), shortliqpt(9999999), protlongstop(0), protshortstop(0), lowestlow3(0),highesthigh3(0),bed
    (0),sed(0),stb(0), sts(0);

    atr=avgtruerange(Length);
    lowestlow3=lowest(low,len2);
    highesthigh3=highest(high,len3);
    bed=0;
    sed=0;
    if (close>=close[1]) then sed=1;
    if (close<=close[1]) then bed=1;
    if(bed=1) then
    begin
    stb=open of tomorrow +.5*(highesthigh3-lowestlow3);
    sts=open of tomorrow -(highesthigh3-lowestlow3);
    end;
    if(sed=1) then
    begin
    stb=open of tomorrow +(highesthigh3-lowestlow3);
    sts=open of tomorrow -.5*(highesthigh3-lowestlow3);
    end;
    if (marketposition=1 and barssinceentry=0) then
    protlongstop=entryprice(0)-3*atr[1];
    if (marketposition=-1 and barssinceentry=0) then
    protshortstop=entryprice(0)+3*atr[1];
    if (marketposition<>marketposition(1)) then
    begin
    ptargmult=1;
    longliqpt=0;
    shortliqpt=999999;
    end;
    if (marketposition=1 and high[1]>entryprice(0)+ (3*atr[1])) then
    begin
    longliqpt=entryprice(0);
    end;
    if (marketposition=-1 and low[1]<entryprice(0)- (3*atr[1])) then
    begin
    shortliqpt=entryprice(0);
    end;
    buy tomorrow at stb stop;
    sellshort tomorrow at sts stop;

    SetStopLoss(Amount);

    -------------------------------------------------------------
     
    MarkBrown likes this.
  2. AbbotAle

    AbbotAle

    Studies have shown the other way as well, selling 1/2 reduces overall profiability and maybe even overall risk.

    With trading there's never one simple answer...
     
    Amatrue likes this.
  3. MarkBrown

    MarkBrown

    in your code "market position" will only work one bar after you have a position it will not work from the time you are actually in a position. so what i am saying is there is a one bar delay in "market position" actually working.

    to get around this you create a variable call it

    var:mp(0);

    then spell out the same conditions that trigger a trade

    if so and so then mp = 1;
    if so and so then mp=-1;

    replace all your conditions using "market position" now with "mp".
     
    Shax and Bad_Badness like this.
  4. Shax

    Shax

    [​IMG]
     
    MarkBrown likes this.
  5. Shax

    Shax

    [​IMG]
     
    AbbotAle likes this.