Replies

henry
24 Jan 2013, 17:14

Excellent Job! Thank you very much. It workes now.

You are right, the position has 10 seconds delay. 


@henry

henry
24 Jan 2013, 04:16

RE:

Sorry, the format is not good above. The samples is from

/api/position

 

The diffrence is the position is  NOT created  by robot. It was created by manual.


@henry

henry
24 Jan 2013, 04:00

I have tried it.  The result is,

If the position is created by cAigo, it workes.

If the position is created bt cTrader(same acct.), it does not work.

So, I  tried another one from your sample. The result is th same.

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


namespace cAlgo.Robots
{
    [Robot]
    public class Mytest : Robot
    {privatePosition position;protectedoverridevoidOnStart(){
 //   Trade.CreateBuyMarketOrder(Symbol,10000);  // this step use cTrader instead.}protectedoverridevoidOnTick(){if(position !=null){Print("The current position's profit is: {0}", position.GrossProfit);Print("The current position's gross profit is: {0}", position.GrossProfit);Print("The current position's Commissions are: {0}", position.Commissions);Print("The current position's TakeProfit is: {0}", position.TakeProfit);Print("The current position's stoploss is: {0}", position.StopLoss);Print("The current position's entryprice is: {0}", position.EntryPrice);Print("The current position's id is: {0}", position.Id);Print("The current position's netprofit is: {0}", position.NetProfit);
      //  Print("The current position's profit is: {0}", position.Profit);Print("The current position's swap is: {0}", position.Swap);Print("The current position's symbolcode is: {0}", position.SymbolCode);Print("The current position's Tradetype is: {0}", position.TradeType);Print("The current position's volume is: {0}", position.Volume);}}protectedoverridevoidOnPositionOpened(Position openedPosition){
   position = openedPosition;}}

 


@henry