Replies

ctid386599
27 Sep 2021, 15:41

RE:

I didn't send the main part of cords to avoid confusion. all I need is to take  the close values of about  20-28 major currency pairs and  do some math on them before deciding which ones are  bearish and which ones are bullish. I  needle the close values in a list

 

PanagiotisCharalampous said:

Hi ctid386599,

I don't understand what do you mean when you say "as accurate as". There is only one closing value for a bar and it is correct.

Regarding the code you posted, I don't really understand it's purpose.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@ctid386599

ctid386599
27 Sep 2021, 14:08 ( Updated at: 27 Sep 2021, 14:20 )

RE:

I just need the last close value

Bars = MarketData.GetBars(TimeFrame.Daily, symbol.Name);

close = Bars.ClosePrices.Last(index);

will  loading the  Timefrme.Dily be as accurate as Timeframe.Minute? or should I use Symbol.Bid/Ask for accurate close value?

I use try and catch because sometimes

the  currency pairs dont load or cant be found

 

sorry for 2nd question. i need multiple currency pairs and i load them like this:

public Symbol[] MySymbols;
protected override void OnStart()
{
            MySymbols = Symbols.GetSymbols("EURGBP", "EURAUD",  "EURUSD", "EURCAD", "EURCHF", "EURNZD", "EURJPY", "GBPAUD", "GBPUSD", "GBPCAD", "GBPCHF", "GBPNZD", "GBPJPY", "AUDUSD", "AUDCAD", "AUDCHF", "AUDNZD", "AUDJPY", "NZDUSD", "NZDCAD", "NZDCHF", "NZDJPY", "USDCAD", "USDCHF", "USDJPY", "CADCHF", "CADJPY", "CHFJPY");
}
 protected override void OnBar()
  {

            foreach (var symbol in MySymbols)
            {
                    try
                    {
                        string name = symbol.Name;
                        //catch (Exception ex)
                    } catch (Exception)
                    {
                        continue;
                    }

                   Bars = MarketData.GetBars(TimeFrame.Daily, symbol.Name);
                   //Bars = MarketData.GetBars(TimeFrame.Minute, symbol.Name);
                    for (int index = 1; index < TheseBars.Count; index++)
                    {
                        Close = TheseBars.OpenPrices.Last(index);
                        if(close!==Null)
                             break;
                    }
             }

}

PROBLEM: I think every bar i load a list of bars for all the 28 currencies which is to heavy. can i load the bars once and just use  index to access the latest bar?

Thank you

 

 

PanagiotisCharalampous said:

Hi ctid386599,

If the strategy operates in OnBar and uses only bar data then in principle you should be able to use bar data instead of tick data without a problem.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@ctid386599

ctid386599
27 Sep 2021, 13:25

RE:

PanagiotisCharalampous said:

Hi ctid386599,

To give more specific advice, we need to know the strategy you are backtesing. Accuracy depends on the way your strategy works. If you can share your source code, we can provide suggestions.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Thank you for reply. Its not about strategy. Its more the fact that its impossible to back test on  ticks data for months even  if the strategy just open  buy on every daily candle because it will take forever to load data every tick. can it load a few ticks to end of day, month etc?


@ctid386599

ctid386599
04 Sep 2018, 17:10

Two strange things

1) my platform icmarkets charges 70$ per million but from Position.Commissions its 81.66 $

2)  Thats commision in  us dollars. I wanted to know it in pips. like  say  after x pips, its break even

 

Thank you


@ctid386599

ctid386599
21 Aug 2018, 14:29

RE: RE:

 

what's the email and password  required in authenticate email, from my gmail account or from my ctrader account?

 


@ctid386599

ctid386599
21 Aug 2018, 14:28

RE:

Dear Panagiotis,

 

The first message I sent did not require any settings. after 1 message.  everything failed.

Again after your message, I set allow less secure apps and  only 1 message was sent then it failed again
Since renko charts have no time watching when there is a move especially when trading  many currencies is nearly impossible. I just wanted to watch over my email to see whenever there is a  new renko brick but the email doesn't work
 

 


@ctid386599

ctid386599
21 Aug 2018, 14:03

Thanks a lot Panagiotis,

Yes its a google security issue. I  clicked allow less secure apps and gmail now accepts.

Thanks. all works now


@ctid386599

ctid386599
21 Aug 2018, 13:40 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Dear  Panagiotis,

Thanks for the reply. However, I'm getting an error message below:

21/08/2018 12:17:26.968 | Failed to send email "Testing email". System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at    at System.Net.Mail.SendMailAsyncResult.End(IAsyncResult result)    at System.Net.Mail.SmtpClient.SendMailCallback(IAsyncResult result)

 

im using gmail

Use SSL
Server(SMTP): smtp.gmail.com
 Port: 587

 

I even try using:

use authentification

username wishpool.one

password from my google account and from  ctrader

 

All fail with this gmail warning:

Critical security alert

A suspicious app was blocked from accessing your account

wishpool.one@gmail.com

 

Thanks in advance

 


@ctid386599

ctid386599
16 Aug 2018, 21:43

RE:

Hi Panagiotis,

I have  renko indicator  and a cbot  gets the renko  blocks.
If i want to run my bot between a given  time interval, the blocks are formed between that time interval.
it means at time =0, there is no brick yet. I would like to have bricks from  say 1 month earlier
 

 


@ctid386599

ctid386599
16 Aug 2018, 18:42

RE:

wishpool.one@gmail.com

 

But its better to not just do it randomly. im implimenting it using a renko indicator.

https://ctrader.com/algos/indicators/show/457

However The renko indicator bricksize is dynamically enlarged if you loose and  restored if you win.

Make me an offer

 

 


@ctid386599

ctid386599
16 Aug 2018, 16:30

Ok, i did not answer to your question right.

 

I have already tried that method too. instead of increasing volume, you increase the  take profit. But it failed because I did not increase SL as well

if you increase only TP and not SL, then the more you loose, the more you increase the probability of loosing again  because TP gets further than SL.

 

if both Sl & TP are increased, then it might  work.

just do the math before you come up with how TP changes. I can  create algorith for that too.

Maybe also increase the volume stepwise slightly


@ctid386599

ctid386599
16 Aug 2018, 16:20

RE:

I can create the bot but I prefer to give you free advice

Its called Martingale Strategy

https://ctrader.com/algos/cbots/show/3

It hardly works because  the sum you loss quickly  grows

bet   loss

1      0

2      3

4     7

8    15

16   31

32   63

64   127

128   253

......

Thats assuming  you loose fixed a mount like pips, but the markert sometimes jumps and you can loose even 150 pips. doubling can not help you unless you change the stop loss , take profit from 50 pips to 150 pips like your loss.

 

once you do that you will wait for eternity and keep doubling your bet just to chase the 1 euro (1st bet) . if you finally win, it will be like wining with the first bet. so much money at stake, time and  sweat

If you still must create the robot then I can create for you that which adapts and ajust the stoploss/take profit pips accordingly .

 

Personally I prefer pseudo Martingale Strategy

ie if you loos you add half of that position  ie 1,2,3,5,8,12, 18,27,41,62,...

it takes the 2nd win to make a profit

 


@ctid386599

ctid386599
16 Aug 2018, 15:57

RE:

After back breaking testing other robots and coding my own, I have come to conclude that there are only 2 ways to make consistent profits

1) Optimization. Have an extra server that just runs optimization of parameters for the bot for a small time window of interest. For example moving avarage might work best for 14 day period  this week and 10 or 20 days period a month ago based on how trending/ ranging that time  was.

2) Use Semi-automatic bot that after analyzing all parameters gives you a signal like alarm to trade but make the final decision to trade or to not trade yourself. some human judgement or very powerful where as robots would require more data, code and are better done by humans.

 

 


@ctid386599

ctid386599
14 Jun 2018, 16:24

Dear thoy1,

Ufortunately no one has the cbot but you.

Was this a question or what is it?


@ctid386599

ctid386599
10 May 2018, 11:07

RE:

Dear Panagiotis,

Unfortunately that won't work for me because if I use a robot to fetch the last value it might be NAN. I got a way todo it but the problem is that IndicatorDataSeries is always the length of index. mine is now shorter and plotted  far away to the left. I have to scroll so far backwards to find the plot. is there a way to allign a chart to the right?

Thanks

 


@ctid386599

ctid386599
27 Mar 2018, 15:00

RE:

im using this renko /algos/indicators/show/1086

using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System;
using System.Collections.Generic;
using System.Linq;
 
namespace cAlgo
{
    [Indicator("Renko", IsOverlay = true, AutoRescale = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Renko : Indicator
    {
        [Parameter("Renko (Pips)", DefaultValue = 10, MinValue = 0.1, Step = 1)]
        public double RenkoPips { get; set; }
 
        [Parameter("Bricks To Show", DefaultValue = 100, MinValue = 1)]
        public int BricksToShow { get; set; }
 
        [Parameter("Zoom Level", DefaultValue = 3, MinValue = 0, MaxValue = 5, Step = 1)]
        public double ZoomLevel { get; set; }
 
        [Parameter("Bullish Color", DefaultValue = "SeaGreen")]
        public string ColorBull { get; set; }
 
        [Parameter("Bearish Color", DefaultValue = "Tomato")]
        public string ColorBear { get; set; }
 
        [Output("Open", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Open { get; set; }
 
        [Output("High", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries High { get; set; }
 
        [Output("Low", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Low { get; set; }
 
        [Output("Close", Color = Colors.DimGray, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries Close { get; set; }
 
        public class Brick
        {
            public double Open { get; set; }
            public double Close { get; set; }
        }
 
        private List<Brick> renkos = new List<Brick>();
        private double closeLastValue, thickness, renkoPips, renkoLastValue;
        private Colors colorBull, colorBear;
        private bool colorError;
        private int lastCount;
 
        protected override void Initialize()
        {
            if (!Enum.TryParse<Colors>(ColorBull, out colorBull) || !Enum.TryParse<Colors>(ColorBear, out colorBear))
                colorError = true;
 
            renkoPips = RenkoPips * Symbol.PipSize;
            thickness = Math.Pow(2, ZoomLevel) - (ZoomLevel > 0 ? 1 : 0);
            renkoLastValue = 0;
        }
 
        public override void Calculate(int index)
        {
            if (colorError)
            {
                ChartObjects.DrawText("Error0", "{o,o}\n/)_)\n \" \"\nOops! Incorrect colors.", StaticPosition.TopCenter, Colors.Gray);
                return;
            }
 
            if (renkoLastValue == 0)
            {
                var open = MarketSeries.Open.LastValue;
 
                renkoLastValue = open - (open % renkoPips) + renkoPips / 2;
            }
 
            closeLastValue = MarketSeries.Close.LastValue;
 
            while (closeLastValue >= renkoLastValue + renkoPips * 1.5)
            {
                renkoLastValue += renkoPips;
                renkos.Insert(0, new Brick 
                {
                    Open = renkoLastValue - renkoPips / 2,
                    Close = renkoLastValue + renkoPips / 2
                });
                if (renkos.Count() > BricksToShow)
                    renkos.RemoveRange(BricksToShow, renkos.Count() - BricksToShow);
                if (IsLastBar)
                    UpdateHistory(index);
            }
            while (closeLastValue <= renkoLastValue - renkoPips * 1.5)
            {
                renkoLastValue -= renkoPips;
                renkos.Insert(0, new Brick 
                {
                    Open = renkoLastValue + renkoPips / 2,
                    Close = renkoLastValue - renkoPips / 2
                });
                if (renkos.Count() > BricksToShow)
                    renkos.RemoveRange(BricksToShow, renkos.Count() - BricksToShow);
                if (IsLastBar)
                    UpdateHistory(index);
            }
 
            bool isNewBar = MarketSeries.Close.Count > lastCount;
 
            if (IsLastBar && isNewBar)
            {
                UpdateHistory(index);
 
                Open[index - BricksToShow] = double.NaN;
                High[index - BricksToShow] = double.NaN;
                Low[index - BricksToShow] = double.NaN;
                Close[index - BricksToShow] = double.NaN;
 
                lastCount = MarketSeries.Close.Count;
            }
 
            if (IsRealTime)
                UpdateLive(index);
        }
 
        private void UpdateHistory(int index)
        {
            for (int i = 0; i < BricksToShow - 1 && i < renkos.Count() - 1; i++)
            {
                var color = renkos[i].Open < renkos[i].Close ? colorBull : colorBear;
 
                ChartObjects.DrawLine(string.Format("renko.Last({0})", i + 1), index - i - 1, renkos[i].Open, index - i - 1, renkos[i].Close, color, thickness, LineStyle.Solid);
 
                Open[index - i - 1] = renkos[i].Open;
                High[index - i - 1] = Math.Max(renkos[i].Open, renkos[i].Close);
                Low[index - i - 1] = Math.Min(renkos[i].Open, renkos[i].Close);
                Close[index - i - 1] = renkos[i].Close;
            }
        }
 
        private void UpdateLive(int index)
        {
            double y1, y2;
            var top = Math.Max(renkos[0].Open, renkos[0].Close);
            var bottom = Math.Min(renkos[0].Open, renkos[0].Close);
 
            if (closeLastValue > top)
                y1 = top;
            else if (closeLastValue < bottom)
                y1 = bottom;
            else
                y1 = closeLastValue;
 
            y2 = closeLastValue;
 
            var colorLive = y1 < y2 ? colorBull : colorBear;
 
            ChartObjects.DrawLine("renko.Live", index, y1, index, y2, colorLive, thickness, LineStyle.Solid);
 
            Open[index] = y1;
            High[index] = y1 > y2 ? y1 : y2;
            Low[index] = y1 < y2 ? y1 : y2;
            Close[index] = y2;
        }
    }
}

I want to  use

private void UpdateHistory(int index)
 {
               Open = renkos[0].Open;
                High = Math.Max(renkos[0].Open, renkos[0].Close);
                Low = Math.Min(renkos[0].Open, renkos[0].Close);
                Close = renkos[0].Close;
}

I just need the newest entries to renkos  which is in [0].

Thanks


@ctid386599

ctid386599
27 Mar 2018, 14:35

RE:

The best would be to be able to have output  which is of type double not of type IndicatorDataSeries
 

 


@ctid386599