Topics
28 Feb 2017, 19:31
 1762
 2
25 Apr 2016, 04:51
 13
 1075
 1
16 Feb 2016, 02:21
 5808
 6
Replies

cyfer
15 Jun 2017, 23:46

You set a Custom Parameter exactly like you did 

You just test it in Initalize 

[Parameter(DefaultValue = "MyCustomValue")]
public string MyParameter{ get; set; }

and in Initalize you test it 

switch(MyParameter)
{
  case "MyCustomValue" : 
                 do something
                 break;
  case "MyCustomValue2"  : 
                 do something
                 break;
  case "MyCustomValue3"  : 
                 do something
                 break;
 default : 
                 do something
                 break ;
}

However , The list thing is not currently possible 

feel free to flame Spotware 

 


@cyfer

cyfer
28 Feb 2017, 19:43

Its OK 

IT only exists in Spotware version because of the limitation of the 100 Lots size , if you double the order , the Modify SL & TP becomes disabled . 

 


@cyfer

cyfer
04 Jan 2017, 08:37

Open your FIX44.xml Dictionary and serach for ExecType , It should be Line 1232 and change the Required="Y" to Required="N"

Basically what's happening here is Your Side is rejecting the incomplete message sent by the Fix Server ! 

So , you simply force it to accept the message . 

I havn't tested if you can change this in the Settings file , it may work 

 

 


@cyfer

cyfer
03 Jan 2017, 05:39

No there is not .

You can't use Fix with hedging accounts cause you'll not be able to close those positions. 

 

on a side note , I can't imaging how did the Qty of 1 opened an order in currencies ! , that's very strange. 

 


@cyfer

cyfer
03 Jan 2017, 04:05

"1" Is not a valid Qty for Currencies and you Selected EUR/USD in  newOrderSingleRequest.Set(new Symbol("1"));

newOrderSingleRequest.Set(new OrderQty('1'))

at least 1000 cause you determine the Qty in terms of Volume not Lots 

 

 

 

 


@cyfer

cyfer
01 Jan 2017, 18:34

Ha ha :) 

Happy New Year 

 


@cyfer

cyfer
01 Jan 2017, 02:09

I havn't coded in Python for years now so I can't really remember how to set this, but what I do in C# "should be the same in Python" is I send the User/Pass in the 

ToAdmin message , Like you set the Parameters of a message .. you set User/Pass in the "ToAdmin" message. 

public void ToAdmin(QuickFix.Message msg, SessionID sessionID)
        {
            if (msg.ToString().Contains("35=A"))// Use Message Cracker instead of this
            {               
                msg.SetField(new QuickFix.Fields.TargetSubID("Quote"));
                msg.SetField(new QuickFix.Fields.Username("*********"));
                msg.SetField(new QuickFix.Fields.Password("*****"));
            }
        }

TargetSubID is another Field that no connections worked without forcing that field in ToAdmin message .. setting this field in the settings file didn't work .. woked only like that. 

ToAdmin message is  Admin level messages so any message from Client side (You) will go through this message . 

FromAdmin is the opposite .. any level from admin(Auth messages mainly) will be received through this message (you need to crack it.)

 


@cyfer

cyfer
18 Dec 2016, 13:09

Try This

MarketDepth marketDepth = new MarketDepth(0);

 


@cyfer

cyfer
14 Dec 2016, 01:32

Hello 

You can discard the Bool Switches cause the calculations are Switches by nature 

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CTDN_EMA_Signal : Indicator
    {
        private MovingAverage MA;
        private bool aboveEMA, belowEma;

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

        [Parameter("MA_Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MA_Type { get; set; }
//+--------------------------------------------------------------+
        protected override void Initialize()
        {
            MA = Indicators.MovingAverage(MarketSeries.Close, MA_Period, MA_Type);
        }
//+--------------------------------------------------------------+
        public override void Calculate(int index)
        {
            if (MarketSeries.Close[index - 1] > MA.Result[index - 1])
            {
                aboveEMA = true;
                belowEma = false;
                ChartObjects.DrawText("Signal", "AboveEma", StaticPosition.BottomLeft, Colors.Green);
            }
            if (MarketSeries.Close[index - 1] < MA.Result[index - 1])
            {
                aboveEMA = false;
                belowEma = true;
                ChartObjects.DrawText("Signal", "BelowEma", StaticPosition.BottomLeft, Colors.Red);
            }

        }
    }
}

 


@cyfer

cyfer
13 Dec 2016, 00:02

Line 13 & 14 should be the opposite in terms of True & False 

 

its a shame that we can't edit our own posts . 


@cyfer

cyfer
12 Dec 2016, 23:05

Concept :

Test the Candle that Closed for the Close price : [index-1]

Test the Previous Value of the EMA  : EMA15.Result[index-1]

Set a Bool Switch For CandleAboveEma & CandleBelowEMA 

Code :

//Init
private bool CandleAboveEma ,CandleBelowEMA ;

Calculate()
{
   if(Marketseries.Close[index-1] > EMA15.Resulst[Index-1])
     {
       CandleAboveEma = True ;
       CandleBelowEMA  = False ;
     }
   else if(Marketseries.Close[index-1] < EMA15.Resulst[Index-1])
    {
      CandleAboveEma = True ;
      CandleBelowEMA  = False ;
    }
}

sure you can make only one Bool and test it ,but his will make sense if you're developing a big Indicator or Robot.

you must test the Previous EMA Value & Previous Candle . .. not the current values . 

 


@cyfer

cyfer
11 Dec 2016, 12:02

First thing you should be aware of .. The server responded to you with a Bid & Ask Prices ... so basically you communicated successfully with the server and it responded . 

Now ,Your Config File instructed To reject the message coming from the Server and the reason was (Tag 42) Which is Orig Time , If you're testing while the market is closed

you should wait till it opens . 

But Make sure that you have those lines in your config file 

StartTime=00:00:00
EndTime=23:59:59

if this is not the solution , please post  how do you send the message to the server QuickFix or Raw Fix from cAlgo ? 

 

 

Here is a MDRequest with a market depth set to 1 like your message .. only changed the Account No.

8=FIX.4.4
9=138
35=V
34=2
49=fxpro.*****
52=20161211-09:29:21.688
56=cServer
49=fxpro.*****
262=MarketDataID
263=1
264=1
267=2
269=0
269=1
146=1
55=1
10=232
20161211-09:29:21.695

and here is the response from the server while the market is closed .

8=FIX.4.4
9=119
35=W
34=2
49=cServer
50=Quote
52=20161211-09:29:20.108
56=fxpro.*******
55=1
268=2
269=0
270=1.05602
269=1
270=1.05609
10=012

 


@cyfer

cyfer
08 Dec 2016, 21:04 ( Updated at: 21 Dec 2023, 09:20 )

You can execlude FxPro , even with the latest cTrader version .. they don't offer Netted accounts .. so you can only get Quotes.

You can Execute Orders but you won't be able to close them. 

 

The way Spotware implemented Fix is not very glorious to say the least ! . 

I had a similar situation when the server doesn't respond .. If you don't get a Reject Response .. usually its the server . not your Code. 

Still if you want to double check .. post the Raw Fix message here ..So we can look at it . 

 

I Think I'll stop my Fix_Bridge project .. I had great hopes for it .. but on cTrader Severs ..Doesn't promise much.

 

 


@cyfer

cyfer
05 Dec 2016, 12:33

 public override void Calculate(int index)
        {
            if (bbds.Top[index-1] < MarketSeries.Close[index-1])
            {
                ChartObjects.DrawText(index.ToString(), "▼", index-1, MarketSeries.High[index-1] + Symbol.PipSize, VerticalAlignment.Top, HorizontalAlignment.Center, Colors.Red);
            }
            if (bbds.Bottom[index-1] > MarketSeries.Close[index-1])
            {
                ChartObjects.DrawText(index.ToString(), "▲", index-1, MarketSeries.Low[index-1] - Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, Colors.Green);
            }
        }

 


@cyfer

cyfer
05 Dec 2016, 02:15

I was not able to conect till I responded to the server the way it did 

I had no successful Logons before forcing that field .. So ..you will have 2 tags with the Value of "Quote"  

Fix Raw

57=Quote

 

if you QuickFix and you're making the Dicitionary dynamically , Pass that tag in the Logon Message

QuickFix

 public void ToAdmin(QuickFix.Message msg, SessionID sessionID)
        {
            if (msg.ToString().Contains("35=A")) //use Message Cracker instead of this
            {      
               msg.SetField(new QuickFix.Fields.TargetSubID("Quote"));
               msg.SetField(new QuickFix.Fields.Username("*******"));
               msg.SetField(new QuickFix.Fields.Password("****"));
            }
        }

 


@cyfer

cyfer
04 Dec 2016, 23:32

I can't follow what's going on here 

why are you opening 2 pending orders after the initial order is filled ??

are you trying to set Stop Loss and Take profit for the "Just opened" Position ? .. in that case you should set those parameters in the call back function

private void OnPositionOpened(PositionOpenedEventArgs args)
{
    var position = args.Position;
    var stopLoss = The Stop Loss you want to set;
    var takeProfit= the Take Profit you want to set;
    ModifyPosition(position, stopLoss, takeProfit);

}

 

 


@cyfer

cyfer
01 Dec 2016, 18:36

Impossible to tell without code , but this is usually due to declaring methods, variables etc outside of any Class . 

after the opening Bracket of the name space you declared a global variable for example ? 


@cyfer

cyfer
18 Sep 2016, 11:29

It is added , but at the end of the Indicators List , So after you click New ... Scroll down to the end and you'll find it 

 


@cyfer

cyfer
25 Aug 2016, 04:29

+1

 


@cyfer

cyfer
02 Aug 2016, 18:52

The forum is formatting the code in a very wrong way 

The code is 

////////////////////////////

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 CTDN_Close_ALL : Robot
    {
        protected override void OnStart()
        {

        }

        protected override void OnTick()
        {
            if (Positions.Count != 0)
            {
                var Trades = Positions.FindAll("");
                foreach (var Trade in Trades)
                {
                    ClosePosition(Trade);

                }
            }
        }

        protected override void OnStop()
        {

        }
    }
}

//////////////////////////////////////////////

There should be no bold or italic of any of that nonsense 

 


@cyfer