Replies

gainer
17 Mar 2016, 11:12

We were advised by Pepperstone that USD has just changed the Daylight Saving Time... so now (...very unusual...) NYCT = UTC + 3

So, to work in NYCT charts, you must change the tiny "current time" in the left bottom corner of your cTrader to UTC + 3

This night i made the check and I confirm, now to work in NYCT you must set the tiny "current time" in the right bottom of your cTrader to UTC + 3

The check it's the simplest you can imagine: if your Broker is NYCT now the midnight of your charts must be at UTC + 3


@gainer

gainer
16 Mar 2016, 23:14

We were advised by Pepperstone that USD has just changed the Daylight Saving Time... so now (...very unusual...) NYCT = UTC + 3

So, to work in NYCT charts, you must change the tiny "current time" in the left bottom corner of your cTrader to UTC + 3
 


@gainer

gainer
10 Mar 2016, 09:53

To be honest, I'm a bit rusty because it was many years ago, so now I simply trust my broker

Years ago, as all of us, I studied around, I joined forum, video courses, webminars and so on, then I decided that my broker had to respect two points

  1. ECN
  2. NYCT

Then I looked around, I made all my comparisons and I decided for Pepperstone, and I am still very happy of my choose

NYCT isn't a simple calculation but it's the broker that declare it's ECN + NYCT and then it's regularly checked and certified by different institution, and Pepperstone is certified ECN + NYCT

For many years I worked with Pepperstone metatrader, before discovering the much more professional and undoubtedly superior cTrader + cAlgo

Well, the Pepperstone metatrder is automatically set to UTC + 2 for 10 months a years, and to UTC + 1 in the 2 months of transition to the daylight saving time, when Europe changes it 1 month before USA, and you can't change it

Besides Pepperstone send us a mail to advise to change the setting of our charts to UTC + 2 and UTC + 1 when it's the time, if we use different platforms than it's metatrader

So no doubt: NYCT = UTC + 2 (and UTC + 1 in the 2 months of transition to daylight saving time) !

I dusted a bit my mind, and here you'll find all you need!


@gainer

gainer
10 Mar 2016, 09:23

To be honest, I'm a bit rusty because it was many years ago, so now I simply trust my broker

Years ago, as all of us, I studied around, I joined forum, video courses, webminars and so on, then I decided that my broker had to respect two points

  1. ECN
  2. NYCT

Then I looked around, I made all my comparisons and I decided for Pepperstone, and I am still very happy of my choose

NYCT isn't a simple calculation but it's the broker that declare it's ECN + NYCT and then it's regularly checked and certified by different institution, and Pepperstone is certified ECN + NYCT

For many years I worked with Pepperstone metatrader, before discovering the much more professional and undoubtedly superior cTrader + cAlgo

Well, the Pepperstone metatrder is automatically set to UTC + 2 for 10 months a years, and to UTC + 1 in the 2 months of transition to the daylight saving time, when Europe changes it 1 month before USA, and you can't change it

Besides Pepperstone send us a mail to advise to change the setting of our charts to UTC + 2 and UTC + 1 when it's the time, if we use different platforms than it's metatrader

So no doubt: NYCT = UTC + 2 (and UTC + 1 in the 2 months of transition to daylight saving time) !


@gainer

gainer
08 Mar 2016, 17:47

I understand your doubts, indeed in my first post I told there are many different theories

You can take a look at this

http://www.forexcfdsignals.com/#!new-york-close-forex-brokers/c24ie

I'm with Pepperstone, that is OFFICIALLY DECLARED NYCT, and it uses only UTC + 2 Charts

In this way the midnight of the chart must match the Wall Street closing!

You can easily check it yourself:

  • in cTrader set the little bottom "current time" option to UTC + 2 and when in your chart it's midnight, you'll see on the bottom left that the New York session disappears

@gainer

gainer
08 Mar 2016, 11:58

RE: Pivot Points

burton.g said:

Pivot point levels were developed by Floor traders and used to give the current trading day's price "context" against yesterdays price range.
The formula is readily available in most platforms.

The pivot formula takes the range of a session from open to close.

Your pivot point settings should reflect the individual open and close times of each instrument you use them on. So the current sessions pivot levels are derived from the previous session.

GB

You are right. Since forex is 24/24 the closing of New York is an optimum reference point


@gainer

gainer
08 Mar 2016, 03:25

Hello, yes you are right (but keep present that there are also other theories)

I use Pivot shifted to New York Closed Time

I solved in this way

  1. Put the indicator shift to ZERO
  2. In the very little "Current Time" option in the right bottom angle of cTrader, set UTC + 2
  3. In this way you are synchronized with the NYCT

...I add a bit of explanation... It isn't a my idea, I simply trust my broker

In fact I'm with Pepperstone that is a New York Close Time Broker

When I used their metatrader, the charts time was blocked at GMT + 2 for 10 months a year, and at GMT + 1 the two month of Daylight Saving Time transition

So when I passed to infinitely superior cTrader/cAlgo, I set the same UTC + 2 to keep the broker NYCT

I hope this may be useful!

 

I remind now a simply test you can do

Trading in NYCT means that it doesn't matter in which corner of world you live, but the midnight of your chart MUST MATCH the Wall Street/New York session closing

In practice they are not your indicators that must shift, but they are your charts that must be synchronized with the Wall Street session

So open the cTrader and set to UTC + 2 in the very little "current time" option in the bottom right corner, and you'll see that the midnight of your charts will match the Wall Street closing

Furthermore in this way you have only to set the shift of your daily indicators to ZERO, launch them on the UTC + 2 chart, and they are already in NYCT

Excuse the long speech, but I use automatically the NYCT since a long time charts and I was a bit rusty on the subject!


@gainer

gainer
07 Mar 2016, 18:57

Hello, yes you are right (but keep present that there are also other theories)

I use Pivot shifted to New York Closed Time

I solved in this way

  1. Put the indicator shift to ZERO
  2. In the very little "Current Time" option in the right bottom angle of cTrader, set UTC + 
  3. In this way you are synchronized with the NYCT

 

...I add a bit of explanation... It isn't a my idea, I simply trust my broker

In fact I'm with Pepperstone that is a New York Close Time Broker

When I used their metatrader, the charts time was blocked at GMT + 2 for 10 months a year, and at GMT + 1 the two month of Daylight Saving Time transition

So when I passed to infinitely superior cTrader/cAlgo, I set the same UTC + 2 to keep the broker NYCT

I hope this may be useful!


@gainer

gainer
07 Mar 2016, 14:44

Hello, yes you are right (but keep present that there are also other theories)

I use Pivot shifted to New York Closed Time

I solved in this way

  1. Put the indicator shift to ZERO
  2. In the very little "Current Time" option in the right bottom angle of cTrader, set UTC + 2
  3. In this way you are synchronized with the NYCT

@gainer

gainer
07 Mar 2016, 09:01

It's a pleasure! We are here to help each other!


@gainer

gainer
06 Mar 2016, 07:56

Hi

The vsix is simply a zipped file

Unzip it in a folder as "VSExtension", then enter in the folder and you'll see the file "extension.vsixmanifest", open it with a normal text editor and add the references to the visual studio community edition between the eligible products

 

      <VisualStudio Version="11.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="12.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="13.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="14.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="15.0">
        <Edition>Community</Edition>
      </VisualStudio>

      

This is the complete code, you can also copy and past it in the extensione.vsixmanifest in place of the current one

 

<?xml version="1.0" encoding="utf-8"?>

<Vsix Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
  <Identifier Id="2c72cc50-6c69-4b16-b1f4-ab470673f284">
    <Name>cBots and Custom Indicators</Name>
    <Author>Spotware</Author>
    <Version>1.4</Version>
    <License>EULA.txt</License>
    <Description xml:space="preserve">Building cBots and Custom Indicators in Visual Studio</Description>
    <Locale>1033</Locale>
    <InstalledByMsi>false</InstalledByMsi>
    <SupportedProducts>
      <VisualStudio Version="10.0">
        <Edition>Pro</Edition>
      </VisualStudio>
      <VisualStudio Version="11.0">
        <Edition>Pro</Edition>
      </VisualStudio>
      <VisualStudio Version="12.0">
        <Edition>Pro</Edition>
      </VisualStudio>
      <VisualStudio Version="11.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="12.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="13.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="14.0">
        <Edition>Community</Edition>
      </VisualStudio>
      <VisualStudio Version="15.0">
        <Edition>Community</Edition>
      </VisualStudio>
    </SupportedProducts>
    <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
  </Identifier>
  <References>
    <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">
      <Name>Visual Studio MPF</Name>
    </Reference>
  </References>
  <Content>
    <VsPackage>VSExtension.pkgdef</VsPackage>
  </Content>
</Vsix>

 

Now from within the directory, zip again all the files in a new "VSExtension.vsix" (be carefull to include all the files, but NOT the directory)

Double click on the new vsix you just created within your directory... and it's done!

Wait for the installatione, then try it: within cAlgo select the "Edit in Visual Studio" option from the left drop down arrow menu near the name of one of your cBots/Indicators and after a while, it will appear in Visual Studio 2015 Community Identifier

That's all and have a good job!


@gainer

gainer
03 Mar 2016, 14:55

Since it's only a partial integration of cAlgo with the Visual Studio 2015 (I always highlight in it's FREE but powerfull Community Edition), the cAlgo internal menu "Edit in Visual Studio" doesn't work and you have to open the project directly, but it's pretty simple

  1. In cAlgo use always the "Build with source code" option, it appears clicking the left dropdown arrow menu, next to your cBot/Indicator name
  2. Open Visual Studio 2015 from its icon and select the top left menu FILE -> RECENT PROJECT AND SOLUTION -> you have only to choose your

To be more specific, if you are interested in the details

  1. In cAlgo always from the same dopdown arrow menu on the left, next to your cBot/Indicator, select the last item "Show in folder"
  2. In the window that appears, you see your cBot/Indicator cAlgo installation file, but also a folder with the same name
  3. In this folder there is the cAlgo project, but also the Visual Studio integration
  4. Open the folder and double click on the file with the name you give to your integrated project, extension .sln, and the Visual Stuio opens it
  5. If you want to deploy or move the project, remember to copy both as the .cAlgo installation file and as its folder

Personally I use only the Visual Studio IDE to develop all my project and it works very fine, both as intellisense editor and as debugger

I hope this my be helpful, waiting for the official cAlgo integration!


@gainer

gainer
27 Feb 2016, 11:00

RE: RE:

gainer said:

davidp13 said:

Hi. Im looking for a way to increase the volume on trades as my account balance increases. For every $1000 the account grows I want to add an additional unit automatically. How would one code something like this?

Thanks

 

Hi, I use this

  1. if you fix a lot, it uses this
  2. if you let lots = 0.0 it uses THE FULL ACCOUNT (I use many small accounts everyone dedicated to a single cBot)
  3. if you want, you can put a variable set to some % of the total account and use it instead of the Account.Balance
  4. you should use the code just before opening your orders, to be sure to have the actual real balance
  5. ...only one note: it doesn't consider the commissions and so on, but normally this isn't a problem, because the rounding let in the account enough to pay them

 

......

public double lots = 0.0;

.....

long maxVolume = Symbol.NormalizeVolume((lots > 0 ? Symbol.QuantityToVolume(lots) : Account.Balance * Account.Leverage), RoundingMode.Down);

.....

 

 

this is the complete code, you must use a % of the total account as parameter, so the money can vary according to your Account.Balance

(...warning! I wrote it now... test it carefully !!!)

 

.....

[Parameter("Fix lots (0 = NO)", DefaultValue = 0.0)]
public double lots { get; set; }

[Parameter("% of the total account to use", DefaultValue = 100.0, MinValue = 0.0, MaxValue = 100.0)]
public double openRatio { get; set; }

.....

long maxVolume = Symbol.NormalizeVolume((lots > 0 ? Symbol.QuantityToVolume(lots) : Account.Balance * Account.Leverage * openRatio / 100), RoundingMode.Down);

 


@gainer

gainer
27 Feb 2016, 10:02

RE:

davidp13 said:

Hi. Im looking for a way to increase the volume on trades as my account balance increases. For every $1000 the account grows I want to add an additional unit automatically. How would one code something like this?

Thanks

 

Hi, I use this

  1. if you fix a lot, it uses this
  2. if you let lots = 0.0 it uses THE FULL ACCOUNT (I use many small accounts everyone dedicated to a single cBot)
  3. if you want, you can put a variable set to some % of the total account and use it instead of the Account.Balance
  4. you should use the code just before opening your orders, to be sure to have the actual real balance
  5. ...only one note: it doesn't consider the commissions and so on, but normally this isn't a problem, because the rounding let in the account enough to pay them

 

......

public double lots = 0.0;

.....

long maxVolume = Symbol.NormalizeVolume((lots > 0 ? Symbol.QuantityToVolume(lots) : Account.Balance * Account.Leverage), RoundingMode.Down);

.....

 


@gainer

gainer
20 Feb 2016, 11:11

...ops... excuse me, an error, because I extracted the snippet from one of my cBots

the setting of colors must be outside of the loop

suggestions:

  • you may put the "sincePips" as a parameter
  • you can put the code as a method and call it periodically from OnTick or with a timer
private DateTime sincePips = new DateTime(2016, 2, 19, 13, 0, 0);

private Colors colorBuy = Colors.Lime;
private Colors colorSell = Colors.Red;
private Colors colorNone = Colors.Yellow;

protected override void OnStart()
{
    double totPips = 0.0;
    string history = string.Empty;
    DateTime sinceTime = (DateTime.Now.Date > sincePips ? DateTime.Now : sincePips);
    Colors colorPips = Colors.Black;

    for (int i = History.Count - 1; i >= 0; i--)
    {
        if (History[i].ClosingTime < sinceTime)
        {
            break;
        }

        totPips += History[i].Pips;
        history += History[i].SymbolCode + " " + History[i].Pips + " " + History[i].ClosingTime + "\r\n";
    }

    if (totPips > 0)
    {
        colorPips = colorBuy;
    }
    else if (totPips < 0)
    {
        colorPips = colorSell;
    }
    else
    {
        colorPips = colorNone;
    }

    history = (totPips > 0 ? "Tot pips GAIN " : "Take pips LOSS ") + totPips.ToString("N1") + "\r\n-----\r\n" + history;
    ChartObjects.DrawText("Pips", history, StaticPosition.TopRight, colorPips);
}

 


@gainer

gainer
16 Feb 2016, 15:23

RE: RE: RE: RE: RE: RE: RE: RE:

hiba7rain said:

Thanks Gainer

i will use return after stop and check it again

 

You're the welcome!

If the "Stop()" in your case doesn't work well either, you can call directly the c# command:

  1. add the "using System.Diagnostics" reference
  2. call the c# Process.GetCurrentProcess().Close();
using System;
using System.Diagnostics; // <---- ADD THIS
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 NewcBot : Robot
    {
        int ticks = 0;

        protected override void OnStart()
        {

        }

        protected override void OnTick()
        {
            Print(ticks++);

            if (ticks == 10)
            {
                Process.GetCurrentProcess().Close();
            }
        }

        protected override void OnStop()
        {

        }
    }
}

 


@gainer

gainer
13 Feb 2016, 02:53

to show a popup you can also use the .net framework System.Windows.Forms

of course, remember to add the reference to System.Windows.Forms
________

....
using System.Windows.Forms;
.....

// the cBot must have the full access privileges
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]

...

protected override void OnStart()
{
    ...

    // check to avoid to use a live accounts by mistake
    if (Account.IsLive && MessageBox.Show("Warning!!! LIVE ACCOUNT!!!\r\n\r\nDo you want to continue anyway?", label, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
    {
        Stop();
        // I noticed that the Stop is immediate if you add also a return after it
        return;
    }

    ,,,
}

 


@gainer

gainer
12 Feb 2016, 14:58

RE: RE: RE: RE: RE: RE:

gainer said:

mindbreaker said:

Pips count and stop:

            // profit pips
            double pips = 0;
            foreach (var trade in Positions)
            {
                pips = pips + trade.Pips;
            }
            if (pips > 100)
            {
                Stop();
            }

I used the Stop(); in some of my cBots and I noticed that the better way to obtain an immediate break of the execution is to add also a return; after the stop();

in my case a check to avoid to use live accounts my mistake:

remember to add a reference to "System.Windows.Forms"
-----

protected override void OnStart()
{
    if (Account.IsLive && System.Windows.Forms.MessageBox.Show("WARNING!!! You are on a LIVE ACCOUNT !!!\r\n\r\nDo you want to continue anyway ?", label, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.No)
    {
        Stop();
        return;
    }
}

 

by the way... I had to use the full declaration "System.Windows.Forms" in the code, to avoid a conflict with another DLL, but the best way to use it is of course this

1) add the reference to "System.Windows.Forms" to your cBot so you can declare the "using"

-----

...

using System.Windows.Forms;

...


if (Account.IsLive && MessageBox.Show("WARNING!!! You are on a LIVE ACCOUNT!!!\r\n\r\nDo you want to continue anyway?", label, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
{
    Stop();
    return;
}

...

 


@gainer

gainer
12 Feb 2016, 14:11

RE: RE: RE: RE: RE:

mindbreaker said:

Pips count and stop:

            // profit pips
            double pips = 0;
            foreach (var trade in Positions)
            {
                pips = pips + trade.Pips;
            }
            if (pips > 100)
            {
                Stop();
            }

I used the Stop(); in some of my cBots and I noticed that the better way to obtain an immediate break of the execution is to add also a return; after the stop();

in my case a check to avoid to use live accounts my mistake:

remember to add a reference to "System.Windows.Forms"
-----

protected override void OnStart()
{
    if (Account.IsLive && System.Windows.Forms.MessageBox.Show("WARNING!!! You are on a LIVE ACCOUNT !!!\r\n\r\nDo you want to continue anyway ?", label, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.No)
    {
        Stop();
        return;
    }
}

 


@gainer

gainer
12 Feb 2016, 14:01

RE: RE:

a note, I write the above code to "translate" this post:

int734 said:

USD / XXX:  

           margin =  contract size / leverage;

XXX / USD:

           margin = current price * contract size / leverage;

XXX / YYY:

   a). (EUR/GBP, AUD/NZD ...)

           margin = crossPrice  * currentPrice(XXX/USD) * contractSize / leverage;

   b). (CAD/CHF, CHF/JPY ....)

           margin = crossPrice / currentPrice(USD/XXX)  * contractSize / leverage;

 

but cAlgo give us wonderful tools and the better code to obtain the max volume given an openMoney quantity is simple this:

maxVolume = Symbol.NormalizeVolume(openMoney * Account.Leverage, RoundingMode.Down);

the choose of the RoundingMode.Down is to avoid to overcome my account balance


@gainer