Topics
Replies

mariushc
09 Apr 2018, 09:55

RE:
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using cAlgo.API.Requests;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class NewBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        //
        int icnt = 0;
        //
        protected override void OnStart()
        {

        }

        protected override void OnTick()
        {
            //
            try
            {

                //mySymbol xxx = new mySymbol(Symbol);
                //TradeResult tr = ExecuteMarketOrder(TradeType.Buy, xxx, 10000, "test", null, 10);
                Level1 lvl1 = new Level1(Symbol, MarketData);

            } catch (Exception ex)
            {
                Console.WriteLine("Error");
            }
            //
            //
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }

        internal class Level1 : Robot
        {
            public Level1(Symbol sss, MarketData md)
            {
                //
                double xxx = sss.Ask;
                MarketData market1 = md;
                Symbol symbol1 = market1.GetSymbol("EURUSD");
                //
                try
                {
                    cAlgo.API.Requests.MarketOrderRequest mor = new MarketOrderRequest(TradeType.Buy, 10000);

                    Trade.CreateBuyMarketOrder(symbol1, 10000);
                    Trade.Send(mor);

                } catch (Exception ex)
                {
                    Console.WriteLine("error");
                }
            }


        }
    }

}

mariushc said:

Sorry guys some code to explain the problem.

Regards

Marius

 

 

 


@mariushc