Replies

bakosadiq
08 Apr 2023, 07:12

RE: Hello

profitstreet.trade said:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class TwoSides : Robot
    {
        [Parameter(DefaultValue = "TwoSides")]
        public string BotName { get; set; }
        
        [Parameter("StopLoss in pips", DefaultValue = 0.00)]
        public int StopLoss { get; set; }

        [Parameter("TakeProfit in pips", DefaultValue = 50)]
         public int TakeProfit { get; set; }
        
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
        public double Quantity { get; set; }
       
        protected override void OnStart()
        {
           Print("CBot Started ");
            
        }

        protected override void OnBar()
        {  
           
           ExecuteMarketOrder(TradeType.Buy,SymbolName,Quantity,BotName,StopLoss,TakeProfit,"MyBot");                 
           ExecuteMarketOrder(TradeType.Sell,SymbolName,Quantity,BotName,StopLoss,TakeProfit,"MyBot");                                     
        }

        protected override void OnStop()
        {
            Print("Bot Stopped ");
        }
    }
}

 

Thanks alot. sorry 4 d late reply


@bakosadiq