Description
Best Settings:
200,26, D1
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.WCentralAfricaStandardTime, AccessRights = AccessRights.None)]
public class OrglobalFxBOT_Double_SSL : Robot
{
[Parameter("Volume", DefaultValue = 1000)]
public double Volume { get; set; }
[Parameter("Length Slow", DefaultValue = 200)]
public int LengthSlow { get; set; }
[Parameter("Length Fast", DefaultValue = 26)]
public int LengthFast { get; set; }
[Parameter("MA Type", DefaultValue = MovingAverageType.WilderSmoothing)]
public MovingAverageType MAType { get; set; }
private SSLChannel sslSlow, sslFast;
protected override void OnStart()
{
sslSlow = Indicators.GetIndicator<SSLChannel>(LengthSlow, MAType);
sslFast = Indicators.GetIndicator<SSLChannel>(LengthFast, MAType);
}
protected override void OnBar()
{
if ((sslFast.SSLUp.HasCrossedAbove(sslFast.SSLDown, 1)) && (sslSlow.SSLUp.Last(1) >sslSlow.SSLDown.Last(1)) )
{
Open(TradeType.Buy, "OrgSSL");
}
else if ((sslFast.SSLUp.HasCrossedBelow(sslFast.SSLDown, 1)) && sslSlow.SSLUp.Last(1) <sslSlow.SSLDown.Last(1) )
{
Open(TradeType.Sell, "OrgSSL");
}
if(sslFast.SSLUp.Last(1) >sslFast.SSLDown.Last(1))
{
Close(TradeType.Sell, "OrgSSL");
}
else if (sslFast.SSLUp.Last(1) <sslFast.SSLDown.Last(1))
{
Close(TradeType.Buy, "OrgSSL");
}
}
private void Close(TradeType tradeType, string Label)
{
foreach (var position in Positions.FindAll(Label, SymbolName, tradeType))
ClosePosition(position);
}
private void Open(TradeType tradeType, string Label)
{
var position = Positions.Find(Label, SymbolName);
if (position == null)
{
ExecuteMarketOrder(tradeType, SymbolName, Volume, Label);
}
}
}
}
Orglobalfx01
Joined on 03.03.2021
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: OrglobalFxBOT_Double_SSL.algo
- Rating: 5
- Installs: 416
- Modified: 05/01/2024 00:18
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.