Description
vende en cada vela segun su periodo de tiempo
whatsapp 3218280967
correo cristianalejandropj@gmail.com
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class ONBARDSELL : Robot
{
[Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.001, Step = 111)]
public double Quantity { get; set; }
[Parameter("Enable TakeProfit?", Group = "TakeProfit", DefaultValue = true)]
public bool useTakeProfit { get; set; }
[Parameter("Take Profit", Group = "TakeProfit", DefaultValue = 6.6, MinValue = 0.1, Step = 0.1)]
public double takeProfit { get; set; }
[Parameter("Enable Stop Loss?", Group = "StopLoss", DefaultValue = true)]
public bool useStopLoss { get; set; }
[Parameter("Stop Loss", Group = "StopLoss", DefaultValue = 0.1, MinValue = 0.1, Step = 0.1)]
public double stopLoss { get; set; }
private MovingAverage tenMinimum;
private MovingAverage tenMaximum;
private double volumeInUnits;
protected override void OnStart()
{
volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);
tenMaximum = Indicators.MovingAverage(Bars.LowPrices, 2, MovingAverageType.Simple);
tenMinimum = Indicators.MovingAverage(Bars.HighPrices, 1, MovingAverageType.Simple);
}
protected override void OnBar()
{
if (Positions.Count() < 2)
{
if (Bars.LastBar.High <= tenMaximum.Result.LastValue && !useTakeProfit)
{
foreach (var position in Positions)
{
ClosePosition(position);
}
}
}
if (Bars.LastBar.Close <= tenMinimum.Result.LastValue)
{
ExecuteMarketOrder(TradeType.Sell, SymbolName, volumeInUnits, "TenMov", (useStopLoss ? stopLoss : double.MaxValue), (useTakeProfit ? takeProfit : double.MaxValue));
}
}
}
}
CR
cristianalejandropj2275
Joined on 24.04.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: ON BARD SELL.algo
- Rating: 0
- Installs: 978
- Modified: 24/04/2022 16:30
Warning! Running cBots downloaded from this section may lead to financial losses. Use them at your own risk.
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.