Information
Username: | 9544315 |
Member since: | 29 Dec 2015 |
Last login: | 29 Dec 2015 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 3 | 1 |
Forum Topics | 6 | 3 |
Jobs | 0 | 6 |
About
I make my own robots and dashboards
Last Algorithm Comments
Last Jobs Comments
// IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE: //
// //
// XRP (XRP) can be sent to this wallet address //
// rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns //
// //
// Basic Attention Token (BAT) can be sent to this wallet address //
// 0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2 //
// //
// Litecoin (LTC) can be sent to this wallet address //
// LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT //
// -------------------------------------------------------------------------------------------------------------//
// The cbot logs at regular intervals defined by the "Tiemr Sec" variable, all of the open position ID+NetProfit+Pips+Swap
// All files are saved with the position ID as file name and in the desktop folder //
// This cBot is intended to be used as a TEST and does not guarantee any particular outcome or //
// profit of any kind. Use it at your own risk. //
// //
// IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE: //
// //
// XRP (XRP) can be sent to this wallet address //
// rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns //
// //
// Basic Attention Token (BAT) can be sent to this wallet address //
// 0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2 //
// //
// Litecoin (LTC) can be sent to this wallet address //
// LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT //
// //
// -------------------------------------------------------------------------------------------------------------//
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.IO;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class OBiAL_DataLogActiveOrders : Robot
{
/// File writer parms
[Parameter("Timer Sec", DefaultValue = 600, MinValue = 1)]
public int TimerSec { get; set; }
// stream for file
StreamWriter _fileWriter;
// desktop folder
static string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
/// File writer parms
protected override void OnStart()
{
DateTime stopdate = new DateTime(2021, 10, 10);
if (Server.Time.Date >= stopdate)
{
Stop();
}
/// File writer parms
Timer.Start(TimerSec);
/// File writer parms
}
protected override void OnTick()
{
//...
}
protected override void OnTimer()
{
///positions routine
foreach (var position in Positions)
{
{
string filePath = Path.Combine(desktopFolder, position.Id + ".txt");
_fileWriter = File.AppendText(filePath);
_fileWriter.AutoFlush = true;
_fileWriter.WriteLine("Server Time: " + Server.Time + " , " + "Position ID: " + position.Id + " , " + "Position NetProfit " + position.NetProfit + " , " + "Position Pips " + position.Pips + " , " + "Position Swap " + position.Swap);
_fileWriter.Close();
}
}
}
protected override void OnStop()
{
/// File writer parms
_fileWriter.Close();
/// File writer parms
}
}
}
// IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE: //
// //
// XRP (XRP) can be sent to this wallet address //
// rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns //
// //
// Basic Attention Token (BAT) can be sent to this wallet address //
// 0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2 //
// //
// Litecoin (LTC) can be sent to this wallet address //
// LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT //
ADD the following to your parameters:
[Parameter("Allow Mon", DefaultValue = true)]
public bool LMon { get; set; }
[Parameter("Allow Tue", DefaultValue = true)]
public bool LTue { get; set; }
[Parameter("Allow Wed", DefaultValue = true)]
public bool LWed { get; set; }
[Parameter("Allow Thu", DefaultValue = true)]
public bool LThu { get; set; }
[Parameter("Allow Fri", DefaultValue = true)]
public bool LFri { get; set; }
ADD the following before your order execution routine:
bool CheckDay = false;
if (Server.Time.DayOfWeek == DayOfWeek.Monday && LMon == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Tuesday && LTue == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Wednesday && LWed == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Thursday && LThu == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Friday && LFri == true)
CheckDay = true;
ADD this condition to the order execution line:
&& CheckDay
If the CheckDay becomes true due to one of the selected days being true, your order will be executed.
// -------------------------------------------------------------------------------------------------------------//
// //
// This cBot is intended to be used as a TEST and does not guarantee any particular outcome or //
// profit of any kind. Use it at your own risk. //
// //
// ALL buy and sell orders are executed at the beginning of a new bar and if the RSI conditions are met. //
// //
// The "OBiAL_RSI_cBot" will create a buy order when: //
// "Relative Strength Index indicator < LVDOUP" and "Relative Strength Index indicator > LVDODO" . //
// //
// The "OBiAL_RSI_cBot" will create a Sell order when: //
// "Relative Strength Index indicator > LVUPDO" and "Relative Strength Index indicator < LVUPUP" . //
// //
// The SL and TP parameters are set for every order of different than zero. //
// //
// The cBot can generate only one Buy or Sell order at any given time. //
// Days of week need to be selcted in order to allow specific ones //
// Hours between Hour plus and Hour minus are allowed for trading. //
// //
// IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE: //
// //
// XRP (XRP) can be sent to this wallet address //
// rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns //
// //
// Basic Attention Token (BAT) can be sent to this wallet address //
// 0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2 //
// //
// Litecoin (LTC) can be sent to this wallet address //
// LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT //
// //
// -------------------------------------------------------------------------------------------------------------//
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class OBiAL_RSI_cBot : Robot
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("RSI Periods", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("Def SL", DefaultValue = 20, MinValue = 0)]
public int DefSL { get; set; }
[Parameter("Def TP", DefaultValue = 20, MinValue = 0)]
public int DefTP { get; set; }
[Parameter("LVUPUP", DefaultValue = 80, MinValue = 0)]
public int LVUPUP { get; set; }
[Parameter("LVUPDO", DefaultValue = 70, MinValue = 0)]
public int LVUPDO { get; set; }
[Parameter("LVDOUP", DefaultValue = 30, MinValue = 0)]
public int LVDOUP { get; set; }
[Parameter("LVDODO", DefaultValue = 20, MinValue = 0)]
public int LVDODO { get; set; }
[Parameter("Allow Buy", DefaultValue = true)]
public bool LBuy { get; set; }
[Parameter("Allow Sell", DefaultValue = true)]
public bool LSell { get; set; }
[Parameter("Allow Mon", DefaultValue = true)]
public bool LMon { get; set; }
[Parameter("Allow Tue", DefaultValue = true)]
public bool LTue { get; set; }
[Parameter("Allow Wed", DefaultValue = true)]
public bool LWed { get; set; }
[Parameter("Allow Thu", DefaultValue = true)]
public bool LThu { get; set; }
[Parameter("Allow Fri", DefaultValue = true)]
public bool LFri { get; set; }
[Parameter("Hour Plus", DefaultValue = 7, MinValue = 0, MaxValue = 23, Step = 1)]
public int HPlus { get; set; }
[Parameter("Hour Minus", DefaultValue = 17, MinValue = 0, Step = 1)]
public int HMinus { get; set; }
private RelativeStrengthIndex rsi;
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
protected override void OnBar()
{
bool CheckDay = false;
if (Server.Time.DayOfWeek == DayOfWeek.Monday && LMon == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Tuesday && LTue == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Wednesday && LWed == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Thursday && LThu == true)
CheckDay = true;
if (Server.Time.DayOfWeek == DayOfWeek.Friday && LFri == true)
CheckDay = true;
bool CheckHour = false;
if (Server.Time.Hour > HPlus && Server.Time.Hour < HMinus)
CheckHour = true;
if (rsi.Result.LastValue < LVDOUP && rsi.Result.LastValue > LVDODO && LBuy && CheckDay && CheckHour)
{
Open(TradeType.Buy);
}
else if (rsi.Result.LastValue > LVUPDO && rsi.Result.LastValue < LVUPUP && LSell && CheckDay && CheckHour)
{
Open(TradeType.Sell);
}
}
private void Close(TradeType tradeType)
{
foreach (var position in Positions.FindAll("TEST_RSI", SymbolName, tradeType))
ClosePosition(position);
}
private void Open(TradeType tradeType)
{
var position = Positions.Find("TEST_RSI", SymbolName, tradeType);
var volumeInUnits = Symbol.QuantityToVolume(Quantity);
if (position == null)
ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "TEST_RSI", DefSL, DefTP);
}
}
}
// -------------------------------------------------------------------------------------------------------------//
// //
// This cBot is intended to be used as a TEST and does not guarantee any particular outcome or //
// profit of any kind. Use it at your own risk. //
// //
// ALL buy and sell orders are executed at the beginning of a new bar and if the RSI conditions are met. //
// //
// The "OBiAL_RSI_cBot" will create a buy order when: //
// "Relative Strength Index indicator < LVDOUP" and "Relative Strength Index indicator > LVDODO" . //
// //
// The "OBiAL_RSI_cBot" will create a Sell order when: //
// "Relative Strength Index indicator > LVUPDO" and "Relative Strength Index indicator < LVUPUP" . //
// //
// The SL and TP parameters are set for every order of different than zero. //
// //
// The cBot can generate only one Buy or Sell order at any given time. //
// //
// IF YOU LIKE THE CODE AND WOULD LIKE TO DONATE: //
// //
// XRP (XRP) can be sent to this wallet address //
// rMdG3ju8pgyVh29ELPWaDuA74CpWW6Fxns //
// //
// Basic Attention Token (BAT) can be sent to this wallet address //
// 0x0bFc0EB112E76C96BA8374AEe8005aFfdca7D4c2 //
// //
// Litecoin (LTC) can be sent to this wallet address //
// LLnDKTB4VEyGLDi33itqZxhvN3AX694zNT //
// //
// -------------------------------------------------------------------------------------------------------------//
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class OBiAL_RSI_cBot : Robot
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("RSI Periods", DefaultValue = 14)]
public int Periods { get; set; }
[Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("Def SL", DefaultValue = 20, MinValue = 0)]
public int DefSL { get; set; }
[Parameter("Def TP", DefaultValue = 20, MinValue = 0)]
public int DefTP { get; set; }
[Parameter("LVUPUP", DefaultValue = 80, MinValue = 0)]
public int LVUPUP { get; set; }
[Parameter("LVUPDO", DefaultValue = 70, MinValue = 0)]
public int LVUPDO { get; set; }
[Parameter("LVDOUP", DefaultValue = 30, MinValue = 0)]
public int LVDOUP { get; set; }
[Parameter("LVDODO", DefaultValue = 20, MinValue = 0)]
public int LVDODO { get; set; }
private RelativeStrengthIndex rsi;
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
protected override void OnBar()
{
if (rsi.Result.LastValue < LVDOUP && rsi.Result.LastValue > LVDODO)
{
Open(TradeType.Buy);
}
else if (rsi.Result.LastValue > LVUPDO && rsi.Result.LastValue < LVUPUP)
{
Open(TradeType.Sell);
}
}
private void Close(TradeType tradeType)
{
foreach (var position in Positions.FindAll("TEST_RSI", SymbolName, tradeType))
ClosePosition(position);
}
private void Open(TradeType tradeType)
{
var position = Positions.Find("TEST_RSI", SymbolName, tradeType);
var volumeInUnits = Symbol.QuantityToVolume(Quantity);
if (position == null)
ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "TEST_RSI", DefSL, DefTP);
}
}
}
I would not suggest anybody use a robot in LIVE account without first:
1. Understanding very throughly what the robot does.
2. What the robots risks are.
3. What part of your account can the robot lose, 0-100%.
If you are sure on all of the above, you can use the robot on any type of account, the code is there.
Just remove the protection