Topics
20 Jul 2018, 22:20
 1339
 1
02 Jul 2018, 12:25
 2879
 4
22 Mar 2018, 17:18
 1550
 5
06 Jan 2018, 13:53
 2252
 4
05 Jul 2016, 18:57
 3024
 3
09 Mar 2016, 17:25
 3262
 3
01 Aug 2015, 15:06
 3229
 3
Replies

tradermatrix
19 Oct 2012, 16:00

thank you very much


@tradermatrix

tradermatrix
11 Oct 2012, 18:53

Attention: the code of the last 3 robots affects all other robots.
For instance one Robot may be closing all positions that are open for the account.
but these robots are engaged in a click to close all open trades. for example the scalping
and also to protect the trades following a sudden market movement.

@+

 


@tradermatrix

tradermatrix
11 Oct 2012, 18:16

CLOSE BALANCE........closes all ordre.ajuster >0 or > 1 or >2 or 3 and  <0 or < -1 or -2 or -3 ... etc.

you can include these robots to other robots.

@+

 

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class CLOSEBALANCE : Robot
    {
          protected override void OnTick()
        {
            if (Account.Equity - Account.Balance > 1 || Account.Equity - Account.Balance < -1)
            {
                foreach (var position in Account.Positions)
                {
                    Trade.Close(position);
                }
            }
        }
   }
}


@tradermatrix

tradermatrix
11 Oct 2012, 17:56

CLOSE POSITIVE BALANCE.....closes all ordre.ajuster >0 or > 1 or >2 or 3 ... etc.

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class CLOSEPOSITIVEBALANCE : Robot
    {
        protected override void OnTick()
{        
    if( Account.Equity - Account.Balance > 0)
    {
    foreach (var position in Account.Positions)
           {
                   Trade.Close(position);
           }
    }
}
}
}

 

 

 

 


@tradermatrix

tradermatrix
11 Oct 2012, 17:48

CLOSE NEGATIVE BALANCE.....closes all ordre.ajuster <0 or < -1 or -2 or -3 ... etc.

using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class  CLOSENEGATIVEBALANCE: Robot
    {
      
    protected override void OnTick()
{        
    if( Account.Equity - Account.Balance < 0 )
    {
    foreach (var position in Account.Positions)
           {
                   Trade.Close(position);
           }
    }
}
}
}

 


@tradermatrix

tradermatrix
11 Oct 2012, 17:37

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class SampleCloseProfitablePositions : Robot
    {
        protected override void OnStart()
        {
            foreach (var position in Account.Positions)
            {
                if (position.GrossProfit < 0)
                {
                    Trade.Close(position);
                }
            }
        }
    }
}


@tradermatrix

tradermatrix
11 Oct 2012, 11:29

hello
yes I've recorded last night and is now online.
for a complete examination of 24 hreures better understand the flow and earnings, here are the details of the account.

2012 Octobre 11, 08:01
Devise : EUR
Opérations
ID Heure d'entrée Symbole Volume Type Prix d'entrée T/P S/L Prix de Clôture Heure de Clôture Commissions Swap EUR
  10/10/2012 07:27 EURUSD 10k Acheter 1.28761 1.28961 1.28561 1.28565 10/10/2012 09:36 -0.60 0.00 -15.24
  10/10/2012 07:27 EURUSD 10k Vendre 1.28759 1.28559 1.28959 1.28559 10/10/2012 09:36 -0.60 0.00 15.55
            - -          
  10/10/2012 09:36 EURUSD 10k Vendre 1.28553 1.28353 1.28753 1.28752 10/10/2012 11:23 -0.60 0.00 -15.45
  10/10/2012 09:36 EURUSD 20k Acheter 1.28564 1.28764 1.28364 1.28764 10/10/2012 11:24 -1.20 0.00 31.06
  10/10/2012 11:23 EURUSD 20k Vendre 1.28750 1.28550 1.28950 1.28949 10/10/2012 12:15 -1.20 0.00 -30.86
  10/10/2012 11:24 EURUSD 10k Acheter 1.28771 1.28971 1.28571 1.28973 10/10/2012 12:15 -0.60 0.00 15.66
  10/10/2012 12:15 EURUSD 10k Acheter 1.28980 1.29180 1.28780 1.28778 10/10/2012 13:38 -0.60 0.00 -15.68
  10/10/2012 12:15 EURUSD 40k Vendre 1.28947 1.28747 1.29147 1.28740 10/10/2012 13:40 -2.40 0.00 64.31
  10/10/2012 13:40 EURUSD 10k Vendre 1.28735 1.28535 1.28935 1.28933 10/10/2012 14:02 -0.60 0.00 -15.35
  10/10/2012 13:38 EURUSD 20k Acheter 1.28782 1.28982 1.28582 1.28988 10/10/2012 14:03 -1.20 0.00 31.94
  10/10/2012 14:02 EURUSD 20k Vendre 1.28931 1.28731 1.29131 1.29129 10/10/2012 14:28 -1.20 0.00 -30.66
  10/10/2012 14:28 EURUSD 40k Vendre 1.29125 1.28925 1.29325 1.28924 10/10/2012 15:36 -2.40 0.00 62.36
  10/10/2012 14:03 EURUSD 10k Acheter 1.28992 1.29192 1.28792 1.28794 10/10/2012 20:55 -0.60 0.00 -15.37
  10/10/2012 15:36 EURUSD 10k Vendre 1.28921 1.28721 1.29121 1.28708 10/10/2012 21:04 -0.60 0.00 16.54
  10/10/2012 20:55 EURUSD 20k Acheter 1.28792 1.28992 1.28592 1.28596 10/10/2012 21:51 -1.20 0.00 -30.48
  10/10/2012 21:04 EURUSD 10k Vendre 1.28704 1.28504 1.28904 1.28498 10/10/2012 21:53 -0.60 0.00 16.03
  10/10/2012 21:51 EURUSD 40k Acheter 1.28589 1.28789 1.28389 1.28390 11/10/2012 00:44 -2.40 0.00 -61.99
  10/10/2012 21:53 EURUSD 10k Vendre 1.28498 1.28298 1.28698 1.28296 11/10/2012 01:30 -0.60 0.00 15.74
  11/10/2012 01:30 EURUSD 10k Vendre 1.28288 1.28088 1.28488 1.28488 11/10/2012 02:28 -0.60 0.00 -15.56
  11/10/2012 00:44 EURUSD 80k Acheter 1.28389 1.28589 1.28189 1.28604 11/10/2012 03:07 -4.80 0.00 133.74
  11/10/2012 02:28 EURUSD 20k Vendre 1.28481 1.28281 1.28681 1.28674 11/10/2012 03:07 -1.20 0.00 -29.99
  11/10/2012 03:07 EURUSD 40k Vendre 1.28678 1.28478 1.28878 1.28478 11/10/2012 06:03 -2.40 0.00 62.27
  11/10/2012 06:03 EURUSD 10k Vendre 1.28466 1.28266 1.28666 1.28665 11/10/2012 06:36 -0.60 0.00 -15.46
  11/10/2012 06:36 EURUSD 20k Vendre 1.28661 1.28461 1.28861 1.28460 11/10/2012 07:10 -1.20 0.00 31.29
  11/10/2012 07:10 EURUSD 10k Vendre 1.28457 1.28257 1.28657 1.28653 11/10/2012 07:17 -0.60 0.00 -15.23
  -30.60 0.00 10 189.17
P&L réalisé : 158.57
Positions
ID Heure Symbole Volume Type Entrée T/P S/L Pips Swap Commissions EUR
  11/10/2012 03:07 EURUSD 10k Buy 1.28629 1.28829 1.28429 2.4 0.00 -0.30 1.87
  11/10/2012 07:17 EURUSD 20k Sell 1.28656 1.28456 1.28856 -0.3 0.00 -0.60 -0.47
  0.00 -0.90 1.40
P&L non réalisé : 0.50
Ordres
ID Heure Symbole Volume Type Entrée Expiration Prix
 
Rapport
                                            Equité :                                                                                  
                                              P&L non réalisé : 0.50                                                   
                                          P&L réalisé : 158.57  

       and the robot continues to work .... good luck


                                  

 

@tradermatrix

tradermatrix
10 Oct 2012, 20:17

using System;
using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot]
    public class TRADERMATRIXPAYBACK : Robot
    {
        [Parameter("Initial Volume", DefaultValue = 10000, MinValue = 0)]
        public int InitialVolume { get; set; }

        [Parameter("Stop Loss", DefaultValue = 20)]
        public int StopLoss { get; set; }

        [Parameter("Take Profit", DefaultValue = 20)]
        public int TakeProfit { get; set; }

        private Position position;
      

        protected override void OnStart()
        {
            ExecuteOrder(InitialVolume, TradeType.Sell);
            ExecuteOrder(InitialVolume, TradeType.Buy);
        }

        private void ExecuteOrder(int volume, TradeType tradeType)
        {
            Trade.CreateMarketOrder(tradeType, Symbol, volume);
        }

        protected override void OnPositionOpened(Position openedPosition)
        {
            position = openedPosition;
            Trade.ModifyPosition(openedPosition, GetAbsoluteStopLoss(openedPosition, StopLoss), GetAbsoluteTakeProfit(openedPosition, TakeProfit));
        }

        protected override void OnPositionClosed(Position closedPosition)
         {
            if (closedPosition.GrossProfit > 0)
            {
                ExecuteOrder(InitialVolume, closedPosition.TradeType);               
            }
            else
            {
                ExecuteOrder((int)closedPosition.Volume * 2, closedPosition.TradeType);
            }
        }
        protected override void OnError(Error error)
        {
            if (error.Code == ErrorCode.BadVolume)
                Stop();
        }

        private double GetAbsoluteStopLoss(Position position, int stopLossInPips)
        {
            return position.TradeType == TradeType.Buy
                ? position.EntryPrice - Symbol.PipSize * stopLossInPips
                : position.EntryPrice + Symbol.PipSize * stopLossInPips;
        }

        private double GetAbsoluteTakeProfit(Position position, int takeProfitInPips)
        {
            return position.TradeType == TradeType.Buy
                ? position.EntryPrice + Symbol.PipSize * takeProfitInPips
                : position.EntryPrice - Symbol.PipSize * takeProfitInPips;
        }
    }
}

 


@tradermatrix

tradermatrix
10 Oct 2012, 20:11

hello

Here is an example of capital gains for a few hours of operation of the robot

[Parameter("Initial Volume", DefaultValue = 10000, MinValue = 0)]
        public int InitialVolume { get; set; }

        [Parameter("Stop Loss", DefaultValue = 20)]
        public int StopLoss { get; set; }

        [Parameter("Take Profit", DefaultValue = 20)]
        public int TakeProfit { get; set; }

 

 

 


10/10/2012 - 10/10/2012
 
Compte :   2012 Octobre 10, 15:42
Devise : EUR
Opérations
ID Heure d'entrée Symbole Volume Type Prix d'entrée T/P S/L Prix de Clôture Heure de Clôture Commissions Swap EUR
  10/10/2012 07:27 EURUSD 10k Acheter 1.28761 1.28961 1.28561 1.28565 10/10/2012 09:36 -0.60 0.00 -15.24
  10/10/2012 07:27 EURUSD 10k Vendre 1.28759 1.28559 1.28959 1.28559 10/10/2012 09:36 -0.60 0.00 15.55
            - -          
  10/10/2012 09:36 EURUSD 10k Vendre 1.28553 1.28353 1.28753 1.28752 10/10/2012 11:23 -0.60 0.00 -15.45
  10/10/2012 09:36 EURUSD 20k Acheter 1.28564 1.28764 1.28364 1.28764 10/10/2012 11:24 -1.20 0.00 31.06
  10/10/2012 11:23 EURUSD 20k Vendre 1.28750 1.28550 1.28950 1.28949 10/10/2012 12:15 -1.20 0.00 -30.86
  10/10/2012 11:24 EURUSD 10k Acheter 1.28771 1.28971 1.28571 1.28973 10/10/2012 12:15 -0.60 0.00 15.66
  10/10/2012 12:15 EURUSD 10k Acheter 1.28980 1.29180 1.28780 1.28778 10/10/2012 13:38 -0.60 0.00 -15.68
  10/10/2012 12:15 EURUSD 40k Vendre 1.28947 1.28747 1.29147 1.28740 10/10/2012 13:40 -2.40 0.00 64.31
  10/10/2012 13:40 EURUSD 10k Vendre 1.28735 1.28535 1.28935 1.28933 10/10/2012 14:02 -0.60 0.00 -15.35
  10/10/2012 13:38 EURUSD 20k Acheter 1.28782 1.28982 1.28582 1.28988 10/10/2012 14:03 -1.20 0.00 31.94
  10/10/2012 14:02 EURUSD 20k Vendre 1.28931 1.28731 1.29131 1.29129 10/10/2012 14:28 -1.20 0.00 -30.66
  10/10/2012 14:28 EURUSD 40k Vendre 1.29125 1.28925 1.29325 1.28924 10/10/2012 15:36 -2.40 0.00 62.36
  -13.20 0.00 10 097.64
P&L réalisé : 84.44
Positions
ID Heure Symbole Volume Type Entrée T/P S/L Pips Swap Commissions EUR
  10/10/2012 14:03 EURUSD 10k Buy 1.28992 1.29192 1.28792 -7.2 0.00 -0.30 -5.58
  10/10/2012 15:36 EURUSD 10k Sell 1.28921 1.28721 1.29121 -0.3 0.00 -0.30 -0.23
  0.00 -0.60

-5.82

P&L non réalisé : -6.42
Ordres
ID Heure Symbole Volume Type Entrée Expiration Prix
 
Rapport
                                                                                            Marge : 100.00                                        
                                            P&L non réalisé : -6.42                                                   
                                             P&L réalisé : 84.44

 

                        .

 

 

 


@tradermatrix

tradermatrix
10 Oct 2012, 00:56

commissions are very low 30 euros to 65 euros (1,000,000 euros)
the spead is 0.00000mini to max 0.00007
this is insignificant.
but must pay whatever toujour strategy .....

good ...!
thanks to all, I found the solution ..!
I tested the robot a few hours and if all goes well I will post tomorrow ..


See you soon my friends traders


@tradermatrix

tradermatrix
09 Oct 2012, 17:43

for PsykotropyK

 

oh! excuse me have you angry with my French but I do not write very well the English.

yes martingale should be used with caution.
but according to the size of its portfolio can change the take profit and stop loss 10 or 20 or 30 or 40 ... etc..
to avert the risk of exceeding the margin.

you can also change the volume: 10000 or 1000 etc ...
brookers offer of margins: 100 or 200 or 500 ....

what I tried to explain that c is a martingale classical random., and the gain is small and sometimes long to come.

The market is random, it rises or descends ...

with two martingales (not random) a buy and sell, the gain is faster ... the market rises or falls.
I would therefore just my 2 robots combine into one robot and improve strategy.

thank you very much.


 


@tradermatrix

tradermatrix
08 Oct 2012, 21:10

merci

mais cela ne fonctionne pas comme mes 2 robots.

exemple martingale classique.

[Parameter("Initial Volume", DefaultValue =10000, MinValue =0)]
publicint InitialVolume {get;set;}

[Parameter("Stop Loss", DefaultValue =20)]
publicint StopLoss {get;set;}

[Parameter("Take Profit", DefaultValue =20)]
publicint TakeProfit {get;set;}

euro monte :euro 1.3

1:sell random (1.3000)volume 10 000....stoploss 1.3020                /perte -20 euros

2:sell(1.3020) volume 20 000 stop loss 1.3040                               /perte -40 euros

3:sell(1.3040) volume 40 000 stop loss  1.3060                              /perte -80 euros

4:sell (1.3060) volume 80 000 stop loss 1.3080                              /perte -160 euros

5:sell (1.3080) volume160 000 ....euro remonte take profit 1.3060 /gain +320 euros

GAIN TOTAL: 5-(1+2+3+4)...320-(20+40+80+160)= 20 euros

tout ça pour seulement 20 euros...!!!!!!

 

 

ma stategie est la suivante:

mettre simultanément en route mes 2 robots paybackSell et paybackBuy

Parameter("Initial Volume", DefaultValue =10000, MinValue =0)]
publicint InitialVolume {get;set;}

[Parameter("Stop Loss", DefaultValue =20)]
publicint StopLoss {get;set;}

[Parameter("Take Profit", DefaultValue =20)]
publicint TakeProfit {get;set;}

euro monte :euro 1.3

paybackSell:

1:sell (1.3000)volume 10 000....stoploss 1.3020                              /perte -20 euros

2:sell(1.3020) volume 20 000 stop loss 1.3040                               /perte -40 euros

3:sell(1.3040) volume 40 000 stop loss 1.3060                               /perte -80 euros

4:sell (1.3060) volume 80 000 stop loss 1.3080                              /perte -160 euros

5:sell (1.3080) volume160 000 ....euro remonte take profit 1.3060  /gain +320 euros

GAIN TOTAL: 5-(1+2+3+4)...320-(20+40+80+160)= 20 euros

pendant ce temps.!!

payback Buy:

buy (1.3000)volume 10 000...take profit 1.3020                                    /gain +20 euros

buy (1.3020)volume 10 000...take profit 1.3040                                    /gain +20 euros

buy (1.3040)volume 10 000 ..take profit 1.3060                                    /gain +20 euros

buy (1.3060)volume 10 000 ..take profit 1.3080                                    /gain +20 euros

gain  80 euros

GAIN TOTAL PAYBACK SELL+ PAYBACK BUY:

20+80= 100 euros

100 euros...!!!!good

 

et les robots continuent de travailler

que le marché monte ou baisse (statégie toujours gagnante)

parfois quelques écarts ou resserments à corriger.

j ai tenté beaucoup de solutions pour créer un seul robot regroupé

 

merci beaucoup

 


@tradermatrix

tradermatrix
12 Sep 2012, 12:38

thank you very much


 good luck

Coffre - trésor coffres coffre

 

 


 cordially

 

TRADERMATRIX


@tradermatrix

tradermatrix
06 Sep 2012, 21:17

YES!Image feu d\'artifice

 

 thank you very much
 I can make beautiful robots

Image science fiction - science fiction extra terrestres surnaturel


 see you soon

 

 

 

TRADERMATRIX Image science fiction - science fiction extra terrestres surnaturel


@tradermatrix

tradermatrix
06 Sep 2012, 14:57

bonjour

Unfortunately not, I want to automatically close all orders Buy and Sell when P & L = 10

the method closes the orders (profit = 10) one after the other

 

cordialement

 

TRADERMATRIX


@tradermatrix

tradermatrix
03 Sep 2012, 18:18

yes I want to cut with TakeProfit when, for example P & L = 10

 [Parameter("Take Profit", DefaultValue = 10)]

EXEMPLE RANGE ROBOT(or another robot)

ID Heure Symbole Volume Type Entrée T/P S/L Pips Swap Commissions EUR
195826 03/09/2012 14:39 EURUSD 10k Sell 1.25745     -0.3 0.00 -0.30 -0.24
195833 03/09/2012 14:42 EURUSD 10k Sell 1.25745     -0.3 0.00 -0.30 -0.24
195862 03/09/2012 15:15 EURUSD 10k Buy 1.25682     5.8 0.00 -0.30 4.61
195875 03/09/2012 15:21 EURUSD 10k Buy 1.25709     3.1 0.00 -0.30 2.47
195899 03/09/2012 15:51 EURUSD 10k Buy 1.25702     3.8 0.00 -0.30 3.02
195945 03/09/2012 16:28 EURUSD 10k Sell 1.25692     -5.6 0.00 -0.30 -4.45
195955 03/09/2012 16:36 EURUSD 20k Sell 1.25692     -5.6 0.00 -0.60 -8.91
195962 03/09/2012 16:41 EURUSD 10k Buy 1.25694     4.6 0.00 -0.30 3.66
195965 03/09/2012 16:44 EURUSD 20k Buy 1.25698     4.2 0.00 -0.60 6.68
195982 03/09/2012 16:49 EURUSD 10k Buy 1.25696     4.4 0.00 -0.30 3.50
196035 03/09/2012 17:21 EURUSD 10k Sell 1.25742     -0.6 0.00 -0.30 -0.48
 

        

 

I want that when P & L = 10, all positions are automatically sold

          cordialement                                                                                                               

  P & L non réalisé 5.72

 

 

 

TRADERMATRIX

 
                  ppppp      

 

lllll

                                                                                                                                                                                                                  

@tradermatrix