Topics
01 Dec 2015, 13:28
 4053
 5
10 Oct 2014, 21:23
 3275
 10
17 Jun 2014, 16:50
 2784
 5
30 May 2014, 16:44
 5166
 10
07 May 2014, 12:08
 4136
 11
Replies

breakermind
28 Oct 2013, 13:10

RE:

cogs said:

Forum posts can be deleted in the database at the hosting the server.

I don't know why you don't respect this users request?

Hi,

exactly as you write.


Maybe the admin does not know it :D:D:D:D

Admin can not know what is intellectual property, maybe want to learn ...

 

 


@breakermind

breakermind
23 Oct 2013, 09:08

RE: RE:

Spotware said:

It is not possible to delete your forum posts and thus your account. You can only delete algorithms that you have previously uploaded. To do so, go to the algorithm page and click on edit. At the bottom left there is the delete button.

breakermind said:

Hello Admin,

i want to delete my indicators and posts inserted on this forum?

Regards, Thanks and bye.

 

Hi,

I'll have to check ... but I think it is posible.

100 stupid posts and scripts be enough i think ?

 


@breakermind

breakermind
21 Oct 2013, 13:10

RE: RE: RE:

virtuesoft said:

atrader said:

Please enlighten the rest of us. What is the problem if too many users trade with the same strategy? Moreover, how many is too many?

 

If there are 50 people trading your robot then you're competing with 50 people to be filled at the same price. You're likely to be filled at a less favourable price which will affect your bottom line. Looking at it from another point of view, if 50 people are trading in your direction it may help move the price in your favour. It's hard to define exactly what impact it can have but I do think cogs is generally correct. The less people trading your robot the better.

if everyone on earth would have to play your works (maybe)
but its stil funny hahahaha

Ok its last post bye.


@breakermind

breakermind
21 Oct 2013, 12:27

RE: RE:

Hello,

somehow it seems to me that none of you have earned nothing for those of your works
if you do have such secrets.
it's ridiculous to put the results of the strategy without code.

buahahaha ridiculous .... bye


@breakermind

breakermind
21 Oct 2013, 11:36

RE:

Cerunnos said:

I agree with you! You're just too good for this forum. Leave this hopeless area. You should instead go to the casino ;-) Good luck!

Yes of course.

But first let Admin delete my posts and indicators.

Thanks and bye and good luck.


@breakermind

breakermind
21 Oct 2013, 11:03

RE: RE: RE:

Cerunnos said:

breakermind said:

Kate said:

You can modify your robot so that logic stays the same, but it's possible to backtest it on whole period. Just initialize everything you need on every Monday, not on robot start. And then we will see the real picture.

Hi,
yes you are right.

This forum is hopeless and I know that.

Please admin delete my profile posts and indicator from this forum !!!

Hi Breakermind,

this forum is not hopeless. You should just not post half-finished robots. Then there are no misunderstandings ... Stay tuned, you're on the right track!

 

Hi,
Yeah, it not a forum just "people".

That was the question:
Is it possible (one week test)?
not year, 4 weeks etc ...

and where I wrote that this robot is completed?

Thanks

Admin Please remove my profile, posts and indicators immediately!

 


@breakermind

breakermind
21 Oct 2013, 10:20

RE:

Kate said:

You can modify your robot so that logic stays the same, but it's possible to backtest it on whole period. Just initialize everything you need on every Monday, not on robot start. And then we will see the real picture.

Hi,
yes you are right.

This forum is hopeless and I know that.

Please admin delete my profile posts and indicator from this forum !!!


@breakermind

breakermind
20 Oct 2013, 21:21

RE:

Cerunnos said:

Perhaps some improvements are still needed :-)

Starting capital: 1000,-
Loss in 4 weeks: -38758,-
Maximum loss: -65000,-
Max drawdown: 6018%

Hi it maybe ... but

$ 50 000 for the last two months with weeks with loss (-$1000)

how can you lose more than you have in your account?

ok it does not matter :)

whether I asked just this week that the test also distinguished colleagues have the same results as me?

Thanks adn bye.


@breakermind

breakermind
20 Oct 2013, 20:27

RE:

MRSV said:

Sorry, but i don't find this robot proffiteble. I think you only got lucky, so i don't thin you wil get simular results in the future. I backtested it one year whit the setings you show in the picture and it ended up whit -6600 dollars. I will try testing it whit some other setting too.

 

Hello,

!!!! You dont read this i think:

//    Start Monday 00:00:00 Stop Friday or when earn

//    Monday to Friday robot tested M5

it is monday to friday robot :]

start on monday stop in friday

Thanks


@breakermind

breakermind
14 Oct 2013, 15:04

RE:

Spotware said:

Please look at the whole example.

You need to find which index corresponds to the series which is of a different Timeframe than the instance of your indicator. 
So, use the method GetIndexByDate as in the example to find the index to use in your m15 series "expo". 

Thanks it works :]

 

//================================================
// boomood3MA                          
//================================================
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.API.Requests;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AutoRescale = false)]
    public class boomood3MA : Indicator
    {
        public int LineBold;
        public Colors LineColor;

        private int Period = 20;
        private MovingAverage expo;
        private MovingAverage expo1;
        private MovingAverage expo2;
        private MovingAverage expo3;

        [Parameter(DefaultValue = 1)]
        public bool MAx3Set { get; set; }

        [Parameter(DefaultValue = 50)]
        public int MA1Period { get; set; }

        [Parameter(DefaultValue = 100)]
        public int MA2Period { get; set; }

        [Parameter(DefaultValue = 200)]
        public int MA3Period { get; set; }


        [Parameter(DefaultValue = 1)]
        public bool RainbowSet { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool M15_RainbowSet { get; set; }

        [Parameter(DefaultValue = 400)]
        public int EnvelopePeriod { get; set; }

        [Parameter(DefaultValue = 0.25)]
        public double BandDistance1 { get; set; }

        [Parameter(DefaultValue = 0.45)]
        public double BandDistance2 { get; set; }

        [Parameter(DefaultValue = 0.6)]
        public double BandDistance3 { get; set; }

        [Parameter(DefaultValue = 0.8)]
        public double BandDistance4 { get; set; }

        [Parameter(DefaultValue = 1.0)]
        public double BandDistance5 { get; set; }

        [Parameter(DefaultValue = 1.7)]
        public double BandDistance6 { get; set; }

        [Output("MA1", Color = Colors.Aqua)]
        public IndicatorDataSeries MA1 { get; set; }

        [Parameter("MA1Type", DefaultValue = 5)]
        public MovingAverageType matype1 { get; set; }


        [Output("MA2", Color = Colors.Red)]
        public IndicatorDataSeries MA2 { get; set; }

        [Parameter("MA2Type", DefaultValue = 5)]
        public MovingAverageType matype2 { get; set; }


        [Output("MA3", Color = Colors.Yellow)]
        public IndicatorDataSeries MA3 { get; set; }

        [Parameter("MA3Type", DefaultValue = 5)]
        public MovingAverageType matype3 { get; set; }


        [Output("MainMA")]
        public IndicatorDataSeries EnvelopeMain { get; set; }

        [Output("ChannelUp1", Color = Colors.Aqua)]
        public IndicatorDataSeries ChannelUp1 { get; set; }

        [Output("ChannelUp2", Color = Colors.Teal)]
        public IndicatorDataSeries ChannelUp2 { get; set; }

        [Output("ChannelUp3", Color = Colors.Yellow)]
        public IndicatorDataSeries ChannelUp3 { get; set; }

        [Output("ChannelUp4", Color = Colors.OrangeRed)]
        public IndicatorDataSeries ChannelUp4 { get; set; }

        [Output("ChannelUp5", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp5 { get; set; }

        [Output("ChannelUp6", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp6 { get; set; }



        [Output("ChannelLow1", Color = Colors.Aqua)]
        public IndicatorDataSeries ChannelLow1 { get; set; }

        [Output("ChannelLow2", Color = Colors.Teal)]
        public IndicatorDataSeries ChannelLow2 { get; set; }

        [Output("ChannelLow3", Color = Colors.Yellow)]
        public IndicatorDataSeries ChannelLow3 { get; set; }

        [Output("ChannelLow4", Color = Colors.OrangeRed)]
        public IndicatorDataSeries ChannelLow4 { get; set; }

        [Output("ChannelLow5", Color = Colors.Red)]
        public IndicatorDataSeries ChannelLow5 { get; set; }

        [Output("ChannelLow6", Color = Colors.Red)]
        public IndicatorDataSeries ChannelLow6 { get; set; }


        [Parameter("MainMAType", DefaultValue = 5)]
        public MovingAverageType matype { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool Set100Levels { get; set; }


        // line bold
        [Parameter(DefaultValue = 1)]
        public bool L1 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L2 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L3 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L4 { get; set; }

        // ===== linr color
        [Parameter(DefaultValue = 1)]
        public bool SetRed { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetWhite { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetBlack { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetGreen { get; set; }


        private MarketSeries m15;
        protected override void Initialize()
        {

            m15 = MarketData.GetSeries(TimeFrame.Minute15);
            expo = Indicators.MovingAverage(m15.Close, EnvelopePeriod, matype);

            //expo = Indicators.MovingAverage(MarketSeries.Close, EnvelopePeriod, matype);
            expo1 = Indicators.MovingAverage(MarketSeries.Close, MA1Period, matype1);
            expo2 = Indicators.MovingAverage(MarketSeries.Close, MA2Period, matype2);
            expo3 = Indicators.MovingAverage(MarketSeries.Close, MA3Period, matype3);
        }




        public override void Calculate(int index)
        {


            if (RainbowSet)
            {
                EnvelopeMain[index] = expo.Result[index];
                ChannelUp1[index] = expo.Result[index] + (expo.Result[index] * BandDistance1) / 100;
                ChannelUp2[index] = expo.Result[index] + (expo.Result[index] * BandDistance2) / 100;
                ChannelUp3[index] = expo.Result[index] + (expo.Result[index] * BandDistance3) / 100;
                ChannelUp4[index] = expo.Result[index] + (expo.Result[index] * BandDistance4) / 100;
                ChannelUp5[index] = expo.Result[index] + (expo.Result[index] * BandDistance5) / 100;
                ChannelUp6[index] = expo.Result[index] + (expo.Result[index] * BandDistance6) / 100;

                ChannelLow1[index] = expo.Result[index] - (expo.Result[index] * BandDistance1) / 100;
                ChannelLow2[index] = expo.Result[index] - (expo.Result[index] * BandDistance2) / 100;
                ChannelLow3[index] = expo.Result[index] - (expo.Result[index] * BandDistance3) / 100;
                ChannelLow4[index] = expo.Result[index] - (expo.Result[index] * BandDistance4) / 100;
                ChannelLow5[index] = expo.Result[index] - (expo.Result[index] * BandDistance5) / 100;
                ChannelLow6[index] = expo.Result[index] - (expo.Result[index] * BandDistance6) / 100;
            }

            if (M15_RainbowSet)
            {
                RainbowSet = false;
                //EnvelopeMain[index] = expo.Result[index];

                var index15 = GetIndexByDate(m15, MarketSeries.OpenTime[index]);
                if (index15 != -1)
                    EnvelopeMain[index] = expo.Result[index15];

                ChannelUp1[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance1) / 100;
                ChannelUp2[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance2) / 100;
                ChannelUp3[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance3) / 100;
                ChannelUp4[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance4) / 100;
                ChannelUp5[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance5) / 100;
                ChannelUp6[index] = expo.Result[index15] + (expo.Result[index15] * BandDistance6) / 100;

                ChannelLow1[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance1) / 100;
                ChannelLow2[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance2) / 100;
                ChannelLow3[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance3) / 100;
                ChannelLow4[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance4) / 100;
                ChannelLow5[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance5) / 100;
                ChannelLow6[index] = expo.Result[index15] - (expo.Result[index15] * BandDistance6) / 100;
            }


            if (MAx3Set)
            {
                MA1[index] = expo1.Result[index];
                MA2[index] = expo2.Result[index];
                MA3[index] = expo3.Result[index];

            }

            if (L1)
            {
                LineBold = 1;
            }
            if (L2)
            {
                LineBold = 2;
            }
            if (L3)
            {
                LineBold = 3;
            }
            if (L4)
            {
                LineBold = 4;
            }

            if (SetRed)
            {
                LineColor = Colors.Red;
            }
            if (SetWhite)
            {
                LineColor = Colors.White;
            }
            if (SetBlack)
            {
                LineColor = Colors.Black;
            }
            if (SetGreen)
            {
                LineColor = Colors.YellowGreen;
            }

            if (Set100Levels)
            {
                for (int i = 1; i < 200; i++)
                {
                    ChartObjects.DrawHorizontalLine("LineLevel" + i, i * 100 * Symbol.PipSize, LineColor, LineBold);
                }
            }


        }
        //calculate
        private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTime[i])
                    return i;
            }
            return -1;
        }
    }
}

Have a nice day and bye ...


@breakermind

breakermind
14 Oct 2013, 13:25

RE:

Spotware said:

You need to get the index that corresponds to the series that is in a different Timeframe. See the example: /forum/whats-new/1463#3

Hi,

that's what it says:
 

             m15 = MarketData.GetSeries(TimeFrame.Minute15);
             expo = Indicators.MovingAverage (m15.Close, EnvelopePeriod, matype);

still not working?

Thanks


@breakermind

breakermind
07 Oct 2013, 22:34

RE: RE:

Hi again,
is no longer valid.
I found a solution elsewhere.
Thanks and bye.


@breakermind

breakermind
07 Oct 2013, 22:13

RE:

I want to write my own little program in C# (cAlgo starts very slowly) retractable belt in windows 8 (tryicon) to establish and close out positions, with the ability to display each graph in another window (each chart on another monitor). But to do that I need to somehow authenticate and log in and retrieve data (preferably with SSL connection).

Support where are you?
Thanks and Bye ...


@breakermind

breakermind
04 Oct 2013, 19:26

Hello,

Is there somewhere an example of how to log in and connect to (cAlgo) server using an external application written in (C #)?

I need to write a widget that displays the status of the currency and allow open and close position

is it possible?

Thanks


@breakermind

breakermind
26 Sep 2013, 14:41

RE: RE:

Indicator download /algos/indicators/show/335


@breakermind

breakermind
24 Sep 2013, 13:02 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Hi and Thanks

 

Indicator code:

//================================================
// breakermind-rainbow                           =
//================================================
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AutoRescale = false)]
    public class EnvelopeChannels : Indicator
    {
        public int LineBold;
        public Colors LineColor;

        private int Period = 20;
        private MovingAverage expo;

        [Parameter(DefaultValue = 1)]
        public bool RainbowSet { get; set; }

        [Parameter(DefaultValue = 400)]
        public int EnvelopePeriod { get; set; }

        [Parameter(DefaultValue = 0.25)]
        public double BandDistance1 { get; set; }

        [Parameter(DefaultValue = 0.45)]
        public double BandDistance2 { get; set; }

        [Parameter(DefaultValue = 0.6)]
        public double BandDistance3 { get; set; }

        [Parameter(DefaultValue = 0.8)]
        public double BandDistance4 { get; set; }

        [Parameter(DefaultValue = 1.0)]
        public double BandDistance5 { get; set; }

        [Parameter(DefaultValue = 1.7)]
        public double BandDistance6 { get; set; }

        [Output("Main")]
        public IndicatorDataSeries EnvelopeMain { get; set; }

        [Output("ChannelUp1", Color = Colors.Aqua)]
        public IndicatorDataSeries ChannelUp1 { get; set; }

        [Output("ChannelUp2", Color = Colors.Teal)]
        public IndicatorDataSeries ChannelUp2 { get; set; }

        [Output("ChannelUp3", Color = Colors.Yellow)]
        public IndicatorDataSeries ChannelUp3 { get; set; }

        [Output("ChannelUp4", Color = Colors.OrangeRed)]
        public IndicatorDataSeries ChannelUp4 { get; set; }

        [Output("ChannelUp5", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp5 { get; set; }

        [Output("ChannelUp6", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp6 { get; set; }



        [Output("ChannelLow1", Color = Colors.Aqua)]
        public IndicatorDataSeries ChannelLow1 { get; set; }

        [Output("ChannelLow2", Color = Colors.Teal)]
        public IndicatorDataSeries ChannelLow2 { get; set; }

        [Output("ChannelLow3", Color = Colors.Yellow)]
        public IndicatorDataSeries ChannelLow3 { get; set; }

        [Output("ChannelLow4", Color = Colors.OrangeRed)]
        public IndicatorDataSeries ChannelLow4 { get; set; }

        [Output("ChannelLow5", Color = Colors.Red)]
        public IndicatorDataSeries ChannelLow5 { get; set; }

        [Output("ChannelLow6", Color = Colors.Red)]
        public IndicatorDataSeries ChannelLow6 { get; set; }


        [Parameter("MAType", DefaultValue = 5)]
        public MovingAverageType matype { get; set; }


        [Parameter(DefaultValue = 0)]
        public bool Set100Levels { get; set; }


        // line bold
        [Parameter(DefaultValue = 1)]
        public bool L1 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L2 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L3 { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool L4 { get; set; }

        // ===== linr color
        [Parameter(DefaultValue = 1)]
        public bool SetRed { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetWhite { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetBlack { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool SetGreen { get; set; }

        protected override void Initialize()
        {

            expo = Indicators.MovingAverage(MarketSeries.Close, EnvelopePeriod, matype);
        }

        public override void Calculate(int index)
        {

            if (RainbowSet)
            {
                EnvelopeMain[index] = expo.Result[index];
                ChannelUp1[index] = expo.Result[index] + (expo.Result[index] * BandDistance1) / 100;
                ChannelUp2[index] = expo.Result[index] + (expo.Result[index] * BandDistance2) / 100;
                ChannelUp3[index] = expo.Result[index] + (expo.Result[index] * BandDistance3) / 100;
                ChannelUp4[index] = expo.Result[index] + (expo.Result[index] * BandDistance4) / 100;
                ChannelUp5[index] = expo.Result[index] + (expo.Result[index] * BandDistance5) / 100;
                ChannelUp6[index] = expo.Result[index] + (expo.Result[index] * BandDistance6) / 100;

                ChannelLow1[index] = expo.Result[index] - (expo.Result[index] * BandDistance1) / 100;
                ChannelLow2[index] = expo.Result[index] - (expo.Result[index] * BandDistance2) / 100;
                ChannelLow3[index] = expo.Result[index] - (expo.Result[index] * BandDistance3) / 100;
                ChannelLow4[index] = expo.Result[index] - (expo.Result[index] * BandDistance4) / 100;
                ChannelLow5[index] = expo.Result[index] - (expo.Result[index] * BandDistance5) / 100;
                ChannelLow6[index] = expo.Result[index] - (expo.Result[index] * BandDistance6) / 100;
            }

            if (L1)
            {
                LineBold = 1;
            }
            if (L2)
            {
                LineBold = 2;
            }
            if (L3)
            {
                LineBold = 3;
            }
            if (L4)
            {
                LineBold = 4;
            }

            if (SetRed)
            {
                LineColor = Colors.Red;
            }
            if (SetWhite)
            {
                LineColor = Colors.White;
            }
            if (SetBlack)
            {
                LineColor = Colors.Black;
            }
            if (SetGreen)
            {
                LineColor = Colors.YellowGreen;
            }

            if (Set100Levels)
            {
                for (int i = 1; i < 200; i++)
                {
                    ChartObjects.DrawHorizontalLine("Dayline" + i, i * 100 * Symbol.PipSize, LineColor, LineBold);
                }
            }


        }
    }
}

 

Image:

 

and Bye ...


@breakermind

breakermind
24 Sep 2013, 11:32

RE:

Spotware said:

If you are referring to lines created using ChartObjects such as ChartObjects.DrawHorizontalLine then this cannot be changed at the moment. You can only set the color thickness and line style from the code.

If you are referring to the horizontal lines added on the chart manually from the toolbox, then you can right click on the line and a settings window will pop up to allow you to make modifications to the line appearance.

Hi
is something like select field (numeric / text) or enum ("text1", "text2"))?

Thanks


@breakermind

breakermind
23 Sep 2013, 19:53

RE:

Spotware said:

You can set the AutoRescale property to false.

    [Indicator(IsOverlay = true, AutoRescale = false)]
    public class EnvelopeChannels : Indicator

/api/indicatorattribute/autorescale

Hi and thanks,

and the next question is how to do select box to select a color?

and something like select fields for the thickness of the line?

I want to set the field thicknes and the color of the line for the horizontal lines

Thanks again ...


@breakermind

breakermind
23 Sep 2013, 16:27 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

Hi and thanks,

I have one question:

how to disable the display calibration(scale) graph chart:

graph without indicator


graph with indicator





how to make that second graph looks the same as the first when the indicator is on ???



and here the  code:

 

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class EnvelopeChannels : Indicator
    {
        private int Period = 10;
        private MovingAverage expo;

        [Parameter(DefaultValue = 0)]
        public bool Set100Levels { get; set; }

        [Parameter(DefaultValue = 0)]
        public bool RainbowSet { get; set; }

        [Parameter(DefaultValue = 20)]
        public int EnvelopePeriod { get; set; }

        [Parameter(DefaultValue = 0.8)]
        public double BandDistance { get; set; }

        [Parameter(DefaultValue = 1.7)]
        public double BandDistance1 { get; set; }

        [Output("Main")]
        public IndicatorDataSeries EnvelopeMain { get; set; }

        [Output("ChannelUp", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp { get; set; }

        [Output("ChannelUp1", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp1 { get; set; }

        [Output("ChannelLow", Color = Colors.Blue)]
        public IndicatorDataSeries ChannelLow { get; set; }

        [Output("ChannelLow1", Color = Colors.Blue)]
        public IndicatorDataSeries ChannelLow1 { get; set; }

        [Parameter("MAType")]
        public MovingAverageType matype { get; set; }

        protected override void Initialize()
        {

            expo = Indicators.MovingAverage(MarketSeries.Close, EnvelopePeriod, matype);
        }

        public override void Calculate(int index)
        {

            if (RainbowSet)
            {
                EnvelopeMain[index] = expo.Result[index];
                ChannelUp1[index] = expo.Result[index] + (expo.Result[index] * BandDistance1) / 100;
                ChannelUp[index] = expo.Result[index] + (expo.Result[index] * BandDistance) / 100;
                ChannelLow[index] = expo.Result[index] - (expo.Result[index] * BandDistance) / 100;
                ChannelLow1[index] = expo.Result[index] - (expo.Result[index] * BandDistance1) / 100;
            }

            if (Set100Levels)
            {
                for (int i = 1; i < 200; i++)
                {
                    ChartObjects.DrawHorizontalLine("Dayline" + i, i * 100 * Symbol.PipSize, Colors.Gray, 2);
                }
            }


        }
    }
}

Thanks and bye


@breakermind

breakermind
21 Aug 2013, 16:26

RE: RE:

Hi

with TrailingStop

//================================================================================
//                                                                  SimpleWeekRobo
// Start at Monday 00:00 close on Friday 21:00
// Simple Monday-Friday script without any security with close when earn
// If CloseWhenEarn == 0 then dont close positions
// if BackStop > 0 then Trailink dont work and BackStop set minimal SL above entryprice
// if TrailingStop == 0 then Trailing dont work
// Trailing and BackStop (Pips value)
//================================================================================
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Requests;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class SimpleWeekRobo : Robot
    {
//================================================================================
//                                                                    Parametrs
//================================================================================

        private Position _position;
        private double WeekStart;

        [Parameter(DefaultValue = false)]
        public bool CloseOnlyWithProfit { get; set; }

        [Parameter(DefaultValue = 10000, MinValue = 1000)]
        public int Volume { get; set; }

        [Parameter(DefaultValue = 25, MinValue = 5)]
        public int Spacing { get; set; }

        [Parameter(DefaultValue = 10, MinValue = 2)]
        public int HowMuchPositions { get; set; }

        [Parameter(DefaultValue = 100, MinValue = 0)]
        public int CloseWhenEarn { get; set; }

        [Parameter(DefaultValue = 0, MinValue = 0)]
        public int BackStop { get; set; }

        [Parameter(DefaultValue = 5, MinValue = 0)]
        public int BackStopValue { get; set; }

        [Parameter(DefaultValue = 0, MinValue = 0)]
        public int TrailingStop { get; set; }

        private bool isFirstBarInitialized;
//================================================================================
//                                                                      OnStart
//================================================================================
        protected override void OnStart()
        {
            // week start price or run script price
            if (CloseOnlyWithProfit == true)
            {
                foreach (var openedPosition in Account.Positions)
                {
                    if (openedPosition.GrossProfit > 0)
                    {
                        Trade.Close(openedPosition);
                    }
                }
            }

            WeekStart = Symbol.Ask;

            for (int i = 1; i < HowMuchPositions; i++)
            {
                Trade.CreateBuyStopOrder(Symbol, Volume, Symbol.Ask + Spacing * i * Symbol.PipSize);
            }
            for (int j = 1; j < HowMuchPositions; j++)
            {
                Trade.CreateSellStopOrder(Symbol, Volume, Symbol.Bid - Spacing * j * Symbol.PipSize);
            }

        }


//================================================================================
//                                                                       OnTick
//================================================================================
        protected override void OnTick()
        {

            //===================================================== Back Trailing
            if (BackStop > 0)
            {
                foreach (var openedPosition in Account.Positions)
                {
                    Position Position = openedPosition;
                    if (Position.TradeType == TradeType.Buy)
                    {
                        double distance = Symbol.Bid - Position.EntryPrice;

                        if (distance >= BackStop * Symbol.PipSize)
                        {
                            double newStopLossPrice = Math.Round(Symbol.Bid - BackStopValue * Symbol.PipSize, Symbol.Digits);

                            if (Position.StopLoss == null)
                            {
                                Trade.ModifyPosition(Position, newStopLossPrice, Position.TakeProfit);
                            }
                        }
                    }
                    else
                    {
                        double distance = Position.EntryPrice - Symbol.Ask;

                        if (distance >= BackStop * Symbol.PipSize)
                        {

                            double newStopLossPrice = Math.Round(Symbol.Ask + BackStopValue * Symbol.PipSize, Symbol.Digits);

                            if (Position.StopLoss == null)
                            {
                                Trade.ModifyPosition(Position, newStopLossPrice, Position.TakeProfit);
                            }
                        }
                    }
                }
            }

            //===================================================== Trailing
            if (TrailingStop > 0 && BackStop == 0)
            {
                foreach (var openedPosition in Account.Positions)
                {
                    Position Position = openedPosition;
                    if (Position.TradeType == TradeType.Buy)
                    {
                        double distance = Symbol.Bid - Position.EntryPrice;

                        if (distance >= TrailingStop * Symbol.PipSize)
                        {
                            double newStopLossPrice = Math.Round(Symbol.Bid - TrailingStop * Symbol.PipSize, Symbol.Digits);

                            if (Position.StopLoss == null || newStopLossPrice > Position.StopLoss)
                            {
                                Trade.ModifyPosition(Position, newStopLossPrice, Position.TakeProfit);
                            }
                        }
                    }
                    else
                    {
                        double distance = Position.EntryPrice - Symbol.Ask;

                        if (distance >= TrailingStop * Symbol.PipSize)
                        {

                            double newStopLossPrice = Math.Round(Symbol.Ask + TrailingStop * Symbol.PipSize, Symbol.Digits);

                            if (Position.StopLoss == null || newStopLossPrice < Position.StopLoss)
                            {
                                Trade.ModifyPosition(Position, newStopLossPrice, Position.TakeProfit);
                            }
                        }
                    }
                }
            }

            //============================================================= Profit close
            var netProfit = 0.0;

            foreach (var openedPosition in Account.Positions)
            {
                netProfit += openedPosition.NetProfit;
            }

            if (netProfit >= CloseWhenEarn && CloseWhenEarn != 0)
            {
                foreach (var openedPosition in Account.Positions)
                {
                    Trade.Close(openedPosition);
                }
                Stop();
            }
        }

//================================================================================
//                                                             OnPositionOpened
//================================================================================
        protected override void OnPositionOpened(Position openedPosition)
        {
            int BuyPos = 0;
            int SellPos = 0;

            foreach (var position in Account.Positions)
            {
                // Count opened positions
                if (position.TradeType == TradeType.Buy)
                {
                    BuyPos = BuyPos + 1;
                }
                if (position.TradeType == TradeType.Sell)
                {
                    SellPos = SellPos + 1;
                }
            }

            Print("All Buy positions: " + BuyPos);
            Print("All Sell positions: " + SellPos);


        }
        // end OnPositionOpened
//================================================================================
//                                                                    Robot end
//================================================================================
    }
}

 


@breakermind