TraDerMaTriX
 TraDerMaTriX's avatar

Info

Username:tradermatrix
Name: TraDerMaTriX
Member since: 24 Jul 2012
Country:France

About

tradermatrix@wanadoo.fr

Signature

None

Last Algorithm Comments

@Pending Order on ADX and MACD:  02 Nov 2019, 12:07


Hello Thank you for sharing your work. I think line 76 for ADX Sell: if (i_adx.ADX.LastValue> 20) is: (i_adx.ADX.LastValue <20) Good trade !! cordially

@SK1 - 28 Pairs Volatility -:  12 Oct 2017, 12:20


hi thank you for this great work, very technical ... it just lacks the opening of a command so that this robot is the most remarkable .... do you have an example or a piece of code adapted to your logic that allows to open and close an order automatically. cordially

@PAYBACK:  15 Jul 2017, 11:59


sean.cappone: Because it is the same label ... I will modify the code .... you will be able to use it with several symbols, at the same time.

@cTrader cBot VPS Memory Manager:  09 May 2017, 11:04


Thank you Paul I will try the adventure I will communicate the results @ +

@cTrader cBot VPS Memory Manager:  08 May 2017, 14:19


hello Paul Does your instrument improve the optimization? Optimization often slows down the computer's virtual memory considerably. Your instrument improves the fluidity of a cbot that has opened a large number of orders (and which slows down all functions) for example to close in an instant 20 or 30 trades .... And finally, I have several computers and several brokers with different accounts a single purchase is it enough ...? with many thanks.

@weekly trading signal:  06 Dec 2016, 15:34


Hi It is an indicator Have you an associated bot cordially

@PAYBACK:  23 Aug 2016, 11:36


asghar250 multiplier OK !! better late than never.... Best regards

@PAYBACK:  23 Aug 2016, 11:32


I returned !!

@Scaling In Bot:  16 Jun 2016, 21:52


Hi, thank you for the code I added a indicator to automate the first order...  that helped to understand the operation. thank you

@ClickAlgo Dashboard Free Version:  30 May 2016, 19:09


Hi Paul I'd be curious to test with full automation. I think you can create a basic set and offer it to everyone, (the operation on demo accounts only). Then everyone could adapt and buy according to their needs (for real accounts) ... I think you will have a high demand. I'll be the first to test a desired set of your creation and buy + if affinity ... Paul thank you for your work. tradermatrix@hotmail.fr Cordially    

Last Forum Posts

@How can i stop my cbot from taking multiple trade using the ontick?:  19 Jan 2021, 21:30


yet it works for me. can be replaced;

var cBotPositions = Positions.FindAll(label);
  if (cBotPositions.Length >= 1)
            return;

by:

 var position = Positions.Find(label);
 if (position == null)

@How can i stop my cbot from taking multiple trade using the ontick?:  19 Jan 2021, 14:46


 using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;


namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class FollowtrendcBot : Robot
    {

        [Parameter(DefaultValue = 1000)]
        public double Volume { get; set; }

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

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

        [Parameter("MA Type", Group = "Moving Average")]
        public MovingAverageType MAType { get; set; }

        [Parameter("Source", Group = "Moving Average")]
        public DataSeries SourceSeries { get; set; }

        [Parameter("Slow Periods", Group = "Moving Average", DefaultValue = 10)]
        public int SlowPeriods { get; set; }

        [Parameter("Fast Periods", Group = "Moving Average", DefaultValue = 5)]
        public int FastPeriods { get; set; }

        [Parameter("Source", Group = "RSI")]
        public DataSeries Source { get; set; }

        [Parameter("Periods", Group = "RSI", DefaultValue = 14)]
        public int Periods { get; set; }

        [Parameter("MACD LongCycle", DefaultValue = 26, MinValue = 1)]
        public int LongCycle { get; set; }

        [Parameter("MACD ShortCycle", DefaultValue = 12, MinValue = 1)]
        public int ShortCycle { get; set; }

        [Parameter("MACD Period", DefaultValue = 9, MinValue = 1)]
        public int MACDPeriod { get; set; }


        private MovingAverage slowMa;
        private MovingAverage fastMa;
        private MacdCrossOver _MACD;
        private RelativeStrengthIndex rsi;
        private const string label = "Follow trend cBot";

        protected override void OnStart()
        {

            fastMa = Indicators.MovingAverage(SourceSeries, FastPeriods, MAType);
            slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType);
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
            _MACD = Indicators.MacdCrossOver(LongCycle, ShortCycle, MACDPeriod);
        }

        protected override void OnTick()
        {

            var currentSlowMa = slowMa.Result.Last(0);
            var currentFastMa = fastMa.Result.Last(0);

            var cBotPositions = Positions.FindAll(label);

            if (cBotPositions.Length >= 1)
                return;


            if (rsi.Result.LastValue > 50 && currentFastMa > currentSlowMa && _MACD.MACD.Last(1) > _MACD.Signal.Last(1))
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, label, StopLoss, TakeProfit);
            }
            else if (rsi.Result.LastValue < 50 && currentFastMa < currentSlowMa && _MACD.MACD.Last(1) < _MACD.Signal.Last(1))
            {

                ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label, StopLoss, TakeProfit);

            }
        }


    }
}

          

@ATR StopLoss problem with US30 indice:  10 Nov 2020, 18:48


PanagiotisCharalampous said:

Hi tradermatrix,

Here you go

 SL = Math.Round(ATR.Result.LastValue * ATRfactor / Symbol.PipSize, 1);

Best Regards,

Panagiotis 

Join us on Telegram

Thank you for you precious help
It works...
cordially

@ATR StopLoss problem with US30 indice:  10 Nov 2020, 14:38


PanagiotisCharalampous said:

Hi tradermatrix,

You should round the stop loss value to one decimal place before using it.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you for your prompt response.
do you have sample code to help me.
I have already tried several methods to round off but without success.
cordially

@ATR StopLoss problem with US30 indice:  10 Nov 2020, 12:10


Hello
with the example below, the c bot works perfectly with the currency. in optimization and in reality ...
and with indices like US30 it works perfectly with baktest or optimization.
But in reality, when starting up, he rejects the purchase or the sale because of:
10/11/2020 10:34:55.510 | → Order OID0 is REJECTED with error "Relative stop loss has invalid precision"
it is probably a decimal problem.
Do you have a solution and an adapted code for this bug
thanks in advance
cordially.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RSIcBotSLATR : Robot
    {
        [Parameter("RSI.ATR.Label n°", DefaultValue = "777")]
        public string RobotID { get; set; }

        [Parameter("Volume", DefaultValue = 1)]
        public double Volume { get; set; }

        [Parameter("RSI Source")]
        public DataSeries Source { get; set; }

        [Parameter("RSI Periods", DefaultValue = 9)]
        public int Periods { get; set; }

        [Parameter("RSI BuyPoint", DefaultValue = 30)]
        public int BuyPoint { get; set; }

        [Parameter("RSI SellPoint", DefaultValue = 70)]
        public int SellPoint { get; set; }

        [Parameter("ATR Periods", DefaultValue = 14)]
        public int ATRPeriod { get; set; }

        [Parameter("ATR Moving Average Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MovingAverageTypeATR { get; set; }

        [Parameter("SL = ATR multiple", DefaultValue = 2)]
        public double ATRfactor { get; set; }

        [Parameter("TP", DefaultValue = 300)]
        public double TP { get; set; }


        public double SL;

        private RelativeStrengthIndex rsi;
        private AverageTrueRange ATR;

        protected override void OnStart()
        {



            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
            ATR = Indicators.AverageTrueRange(ATRPeriod, MovingAverageTypeATR);
        }




        protected override void OnTick()
        {

            var cBotPositions = Positions.FindAll(RobotID);

            if (cBotPositions.Length >= 1)
                return;

            SL = ATR.Result.LastValue * ATRfactor / Symbol.PipSize;

            if (rsi.Result.LastValue < BuyPoint)
            {
                ExecuteMarketOrder(TradeType.Buy, SymbolName, Volume, RobotID, SL, TP);
            }
            else if (rsi.Result.LastValue > SellPoint)
            {

                ExecuteMarketOrder(TradeType.Buy, SymbolName, Volume, RobotID, SL, TP);

            }
        }

    }

}

@Limit positions with different labels:  27 Jul 2020, 10:56


Hi
I have built a robot with several signals independent of each other, with a different label per signal.
for example :
  RobotID_A1
  RobotID_A2
  RobotID_A3
  RobotID_A4
so 4 positions are possible together
I would like to limit to 2 open positions (the robot chooses the 2 best signals depending on the market)
but how to proceed with different labels.
cordially.

@use multiple timers and events OnTimer ():  20 Jul 2020, 17:43


Thank you for your precious help, I will experiment your method and look for a solution to adapt it to my needs.
Best Regards,

@use multiple timers and events OnTimer ():  20 Jul 2020, 16:08


PanagiotisCharalampous said:

Hi tradermatrix,

I do not see why you cannot implement different checks with a single timer event, one for every strategy. It needs some coding but its achievable. 

Best Regards,

Panagiotis 

Join us on Telegram

Thank you for your reply.
so I am making a mistake.
Do you have a sample code to share?

@use multiple timers and events OnTimer ():  20 Jul 2020, 15:11


PanagiotisCharalampous said:

Hi tradermatrix,

At the moment you can only have one instance of the Timer. You will need to implement your logic with this limitation in mind.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis
Thank you for your reply.
It is a shame because for example I have a robot with 14 different strategies and I am therefore obliged to keep the same deadlines for all instances.
I even think that if the timer is open on a robot, it also intervenes on another robot in operation.
The "OnTimer ()" timer should be associated with the label, this would create several instances of different timers ...

otherwise the method "System.Threading.Thread.Sleep (60000 * _Interval1);" is very easy to use and works on as many desired instances but is still not compatible with backtesting or optimization.
cordially

@use multiple timers and events OnTimer ():  18 Jul 2020, 19:47


Hello
I would like to use multiple timers and events OnTimer ()
For example, I want a timer to count 100 minutes periods and then trigger an event, and another timer to count minutes and trigger an event at 300 minutes.
In the simple example below, if you operate each indicator independently it works perfectly.
But if the 2 indicators work together, it is always the last timer (Interval MACD int _Interval2) which manages all the events ...
Interval MA int _Interval1: no longer useful.
you will realize this by adding the MA + MACD results with a backtesting for each indicator and then a backtesting together ...

I have the impression that we cannot create several partitions with OnTimer ()
I may also be making a coding error

is there another method to work around the problem.
cordially

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class EXEMPLEDOUBLETIMER : Robot
    {
        [Parameter("Volume", DefaultValue = 10000)]
        public double volume { get; set; }

        [Parameter("----------MA------------", DefaultValue = "MA")]
        public string Separator1 { get; set; }

        [Parameter("Use MA", DefaultValue = true)]
        public bool UseMA { get; set; }

        [Parameter("Interval (Minut)", DefaultValue = 100)]
        public int _Interval1 { get; set; }

        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Period", DefaultValue = 125)]
        public int Period { get; set; }

        [Parameter("Moving Average Type", DefaultValue = MovingAverageType.TimeSeries)]
        public MovingAverageType MovingAverageType { get; set; }

        [Parameter("SL ", DefaultValue = 160)]
        public int sl1 { get; set; }

        [Parameter("TP ", DefaultValue = 80)]
        public int tp1 { get; set; }

        [Parameter("----------MACD------------", DefaultValue = "MACD")]
        public string Separator2 { get; set; }

        [Parameter("Use MAcd", DefaultValue = true)]
        public bool UseMACD { get; set; }

        [Parameter("Interval (Minut)", DefaultValue = 300)]
        public int _Interval2 { get; set; }

        [Parameter("MACD LongCycle", DefaultValue = 26, MinValue = 1)]
        public int LongCycle { get; set; }

        [Parameter("MACD ShortCycle", DefaultValue = 12, MinValue = 1)]
        public int ShortCycle { get; set; }

        [Parameter("MACD Period", DefaultValue = 9, MinValue = 1)]
        public int MACDPeriod { get; set; }

        [Parameter("SL ", DefaultValue = 160)]
        public int sl2 { get; set; }

        [Parameter("TP ", DefaultValue = 80)]
        public int tp2 { get; set; }

        private MacdHistogram MACD;

        private MovingAverage MA;

        protected override void OnStart()
        {



            MA = Indicators.MovingAverage(Source, Period, MovingAverageType);

            MACD = Indicators.MacdHistogram(LongCycle, ShortCycle, MACDPeriod);


            TIMER();
            TIMER2();

        }
        private void TIMER()
        {

            if (UseMA)
                Timer.Start(_Interval1 * 60);


        }

        private void TIMER2()
        {

            if (UseMACD)
                Timer.Start(_Interval2 * 60);


        }
        protected override void OnTimer()
        {

            ManagePositions1();
            ManagePositions2();

        }
        protected override void OnTick()
        {



            //   ManagePositions1();
            //   ManagePositions2();
        }

        private void ManagePositions1()
        {
            var cBotPositions = Positions.FindAll("MoVinG");

            if (cBotPositions.Length >= 1)
                return;

            double MA2 = MA.Result[MA.Result.Count - 2];
            int bars = MarketSeries.Close.Count - 1;
            double cl = MarketSeries.Close[bars - 1];




            if (UseMA && MA2 < cl)
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "MoVinG", sl1, tp1);

            }
            else if (UseMA && MA2 > cl)
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "MoVinG", sl1, tp1);
            }
        }
        private void ManagePositions2()
        {
            var cBotPositions = Positions.FindAll("Macd");

            if (cBotPositions.Length >= 1)
                return;


            if (UseMACD && MACD.Histogram.LastValue > 0.0 && MACD.Signal.IsRising())
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "Macd", sl2, tp2);

            }
            else if (UseMACD && MACD.Histogram.LastValue < 0.0 && MACD.Signal.IsFalling())
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "Macd", sl2, tp2);
            }
        }



    }
}




Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
PAYBACK
  23
  3
  9548
free  15 Jul 2017
15/07/2017 To meet the demand of many. I added the function interchangeable label, on the dashboard. You can work on several symbols at the same time, opening multiple instances. For example: first instance Robot Label ... "buy eurusd" .... second instances ........ buy usdjpy .... Or buy1 .... buy2 ... sell1 ... sell2 ... etc ... at your convenience ...   22/08/2016 volume change (lots) Adding volume Max. in automat mode if the max volume is winning or losing, the volume returns to the original volume. automate = false, the robot works up to gain ... or maxvolume (winning or losing). I added an option to StopOrder and LimitOrder. ("Martingale NONSTOP") ex: if Martingale NONSTOP  = true; if lost, the martingale works as previously ... ( change the direction Martingale + maxvolume) if Martingale NONSTOP= false; if losing = 2 pendigorders oco  (multiplied by martingale) .. and c is the direction of the market that decides  of the sell and buy order. (with maxvolume option) .Net profit (return Commissions) buy, sell, StopOrder, LimitOrder separately visible on the screen.   good trades.     14/08/2015 Adding Limit Order / martingale :yes..no / oco... 12/08/2015:Adding stop order choose the direction:Start buy/Start Sell, multiplier,volume and TP/SL change the direction =true : ↗/↘:When SL is hit trade  in the other meaning. Start Automate =true : begins the cycle after each TP. ability to sell and buy together(separate adjustment) bottom right = net profit - return Commissions create two trades: buying and selling when a trade is negative, you win on the other. the martingale (non-random) reimburse the losing trades. that the market goes up or down you generate profits. Attention to the margin adjust the stop loss and take profit depending on the size of your wallet and your leverage good luck