Scalper free

by qualitiedx2 in category Other at 16/03/2012
Description
This is a Scalper Robot
12763 downloads
How to install
Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Robot. 
//    Please use the  Feedback  tab to provide us with your suggestions about cAlgo s API.
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using System.Collections.Generic;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class Scalper : Robot
    {
        [Parameter("BarCount",DefaultValue=4)]
        public int BarCount { get; set; }
        
        [Parameter("MaxOrders",DefaultValue=10)]
        public int MaxOrders { get; set; }
        
        [Parameter("TakeProfit",DefaultValue=100)]
        public int TakeProfit { get; set; }
        
        [Parameter("StopLoss",DefaultValue=100)]
        public int StopLoss { get; set; }
        
        [Parameter("Volume",DefaultValue=10000)]
        public int Volume { get; set; }
        
        [Parameter("MaxDropDown",DefaultValue=0)]
        public double MaxDropDown { get; set; }
        
        [Parameter("MaxProfit",DefaultValue=0)]
        public double MaxProfit { get; set; }
        
        private int PosOpen=0;
        private int OpenIndex=0;
        private double StartBalanse;
        private DateTime dt;
        
        protected override void OnStart()
        {
            StartBalanse=Account.Balance;
            dt=Server.Time;
        }

        protected override void OnTick()
        {
            int last=MarketSeries.Close.Count-1;
            if(!(MarketSeries.Open[last]==MarketSeries.High[last] && MarketSeries.Open[last]==MarketSeries.Low[last])) return;
            if(dt.Date!=Server.Time.Date)
            {
            	StartBalanse=Account.Balance;
            	dt=Server.Time;
            }
            
            double bp=(StartBalanse-Account.Balance)/(StartBalanse/100);
            if(bp>0 && bp>=MaxDropDown && MaxDropDown!=0) return;
            if(bp<0 && Math.Abs(bp)>=MaxProfit && MaxProfit!=0) return;
            if(BarCount<1)
            {
              Print("0;> 10@>2 4;O 0=0;870 B@5=40. BarCount 4>;6=> 1KBL 1>;LH5 8;8 @02=> 1");
              return;
            }
            if(PosOpen<MaxOrders)
            {
      			if(OpenIndex==0 || last-OpenIndex>BarCount)
      			{
            		if(IsBuy(last))
            		{
            			Trade.CreateBuyMarketOrder(Symbol,Volume);
            			PosOpen++;
            			OpenIndex=last;
            		}
            		if(IsSell(last))
            		{
            			Trade.CreateSellMarketOrder(Symbol,Volume);
            			PosOpen++;
            			OpenIndex=last;
            		}
            	}
            }
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
        
        protected override void OnPositionOpened(Position openedPosition)
        {
            if(openedPosition.TradeType==TradeType.Buy)
            	Trade.ModifyPosition(openedPosition,Symbol.Ask-StopLoss*Symbol.PointSize,Symbol.Ask+TakeProfit*Symbol.PointSize);
            if(openedPosition.TradeType==TradeType.Sell)
            	Trade.ModifyPosition(openedPosition,Symbol.Bid+StopLoss*Symbol.PointSize,Symbol.Bid-TakeProfit*Symbol.PointSize);
        }
        
        protected override void OnPositionClosed(Position position)
        {
        	PosOpen--;
        	if(PosOpen<0) PosOpen=0;
        }
        
        private bool IsBuy(int last)
        {
        	
        	for(int i=BarCount;i>0;i--)
        	{
        		if(MarketSeries.Open[last-i]<MarketSeries.Close[last-i]) return false;
        		if(i<2) continue;
        		if(MarketSeries.High[last-i]>MarketSeries.High[last-i-1]) return false;
        	}
        	return true;
        }
        
        private bool IsSell(int last)
        {
        	
        	for(int i=BarCount;i>0;i--)
        	{
        		if(MarketSeries.Open[last-i]>MarketSeries.Close[last-i]) return false;
        		if(i<2) continue;
        		if(MarketSeries.Low[last-i]<MarketSeries.Low[last-i-1]) return false;
        	}
        	return true;
        }
    }
}
Comments

Anonymous - September 10, 2012 @ 11:34

with.. no backtesting, no description, no screenshots, no explanation and no profit/loss? I don't think anyone will use it

alualdi - October 04, 2012 @ 07:50

at least specify what timeframe it should be used on...

Anonymous - October 08, 2012 @ 17:39

thanks

lihink86 - November 30, 2012 @ 16:37

How do I use the Trader platform MasterForex?

lihink86 - November 30, 2012 @ 16:38

How do I use the Trader platform MasterForex?
0