Could not use bool Parameter as an input?

Created at 14 Sep 2012, 12:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
QI

Qingyang2005

Joined 14.09.2012

Could not use bool Parameter as an input?
14 Sep 2012, 12:01


hi everyone,

         I'm trying to use a bool var as input parameter , 

         [Parameter("TradeOnce", DefaultValue = true)]        

         public bool TradeOnce1 {get;set;}

 

         I got this message while i try to complile it .

 

 

        I'm running it on Windows Server 2003 Enterprise Edition Service Pack 2,

     With i5-2400 and 8GB RAM.

    

         Any help will be much appreciated.

         Thanks in advance.

                                     ---Qing

 

 

        

      


@Qingyang2005
Replies

rupweb
14 Sep 2012, 12:24

I had the same problem with "trace" through logs (turning the trace on or off) so I changed the Bool to int.

Then you'd have TradeHowManyTimes and use that, instead of TradeOnce (or make TradeOnce set to 1 or 0).

my 10 cents...


@rupweb

Qingyang2005
14 Sep 2012, 14:05

Thanks

hi rupweb,

    I just did it like what you said before i saw your great Suggestion:)

    Thank you very much.

 

    but i hope the admin update the software.

 

    and also ,

    1, i hope the software will be able to  monitor the robots files's modification, e.g. 

    the software will promt clients if the .cs file was modified by vs2010 and can load it again.

    2, the robot editor can replace and find sth. 

 

 

 


@Qingyang2005

rupweb
14 Sep 2012, 16:36

Hi Qingyang2005... hehe the fact you point out the editor is not up to VS standards does make me laugh... I have also been cutting and pasting and so on, working manually. But I guess that for me the editor has most of the functionality needed. What I would like is an OnPositionModified method so that once a Trade is placed then just as soon as my stops and takeprofits are bolted to the Trade I can easily see the result, which at the moment I find I cannot, but I know it IS working.

cheers, Rupweb.

There Is No Signal


@rupweb

daemon
14 Sep 2012, 17:38

You can actually set the output path in your project properties (Build Tab) to the location of the Robots/Indicators and then it will update automatically when you build from VS.


@daemon

Qingyang2005
14 Sep 2012, 17:58

Hi daemon , thanks for your advice , i'll have a try :)

 

hi , rupweb , you can modify your sl and tp here.    try it .

protected override void OnPositionOpened(Position openedPosition)
{
      // try to modify your sl and tp here ...
        
}

thank you all .
        
     


@Qingyang2005

Qingyang2005
14 Sep 2012, 18:01

But how to access history orders by API ?

I found nothing about it .

any help will be much appreciated.

 


@Qingyang2005

rupweb
14 Sep 2012, 18:06

Thanks Qingyang2005, yes OnPositionOpened and then             

Trade.ModifyPosition(openedPosition, GetAbsoluteStopLoss(openedPosition, StopLoss), GetAbsoluteTakeProfit(openedPosition, TakeProfit));

But what I want to see is the return from the Trade method, it goes to the server then not sure how to capture the response, think it's void.

Also would like step-by-step code execution of the .cs robot, is that possible in VS?


@rupweb

admin
24 Sep 2012, 19:18

Hello,

 

The Trade methods return void. You will get a response if something goes wrong in the OnError event.  Otherwise a position will be opened or a pending order will be created in which case you can control execution in the events OnPositionOpened and OnPendingOrderCreated, respectively.

Access to historical orders as well as bool and other data types as input parameters is coming soon. Stay tuned.

Tracing through the code in debug mode is not possible for cAlgo in Visual Studio, but what you can do instead is use Print statements within your code so that you can troubleshoot your algorithms.

 

For future reference, please start a new Post for each question so that we can better assist you.

 


@admin

cAlgo_Development
26 Jun 2013, 12:31

Boolean type parameters are implemented in last release:

        [Parameter("Use Stop Loss", DefaultValue = true)]
        public bool UseStopLoss { get; set; }

 


@cAlgo_Development