Description
Acumulative Swing Index Bot
Este bot usa el indicador de Acumulative Swing Index para determinar si se realizan compras o ventas, este ejemplo fue realizado en el EURUSD | h6
Cualquier duda o aclaración pueden contactarme: @arteagagalicia
Autor: Jorge Eduardo Arteaga Galicia
@arteagagalicia
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 ASIBOT : Robot
{
private double _volumeInUnits;
private AccumulativeSwingIndex _accumulativeSwingIndex;
private const string Label = "Acumulative Swing Index";
[Parameter("Lots", DefaultValue = 1, Group = "Autor: Jorge Arteaga\n@arteagagalicia\n\nLots")]
public double Lots { get; set; }
[Parameter("Periods", DefaultValue = 12, Group = "ASI Indicator")]
public int Periods { get; set; }
[Parameter("Equity", DefaultValue = 0, Group = "ASI Indicator")]
public int Equity { get; set; }
protected override void OnStart()
{
// Put your initialization logic here
_volumeInUnits = Symbol.QuantityToVolumeInUnits(Lots);
_accumulativeSwingIndex = Indicators.AccumulativeSwingIndex(Periods);
}
protected override void OnTick()
{
// Put your core logic here
var shortPosition = Positions.Find(Label, SymbolName, TradeType.Sell);
var longPosition = Positions.Find(Label, SymbolName, TradeType.Buy);
if (_accumulativeSwingIndex.Result.Last(1) > Equity && _accumulativeSwingIndex.Result.Last(2) <= Equity && longPosition == null)
{
ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label);
if (shortPosition != null)
{
ClosePosition(shortPosition);
}
}
else if (_accumulativeSwingIndex.Result.Last(1) < Equity && _accumulativeSwingIndex.Result.Last(2) >= Equity && shortPosition == null)
{
ExecuteMarketOrder(TradeType.Sell, SymbolName, _volumeInUnits, Label);
if (longPosition != null)
{
ClosePosition(longPosition);
}
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
jorgearteaga
Joined on 12.02.2021
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: ASIBOT.algo
- Rating: 5
- Installs: 1935
- Modified: 16/11/2021 19:31
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.
GA
Hola, sencillo pero eficaz robot sin embargo la pregunta de confirmar la señal antes de abrir queda por resolver.
Is this bot working on my Jojoy app because this app provide modded version of app.