crash
crash
10 Aug 2023, 21:08
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class Revenant : Robot
{
[Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("Take Profit (pips)", Group = "Protection", DefaultValue = 15, MinValue = 1)]
public int TakeProfitInPips { get; set; }
private const string label = "Revenant";
private MovingAverage Mv10D;
private MovingAverage Mv10H;
protected override void OnStart()
{
var EURUSDSeriesDay = MarketData.GetBars(TimeFrame.Daily);
var EUEUSDSeries1h = MarketData.GetBars(TimeFrame.Hour);
var hedging1 =Positions.Find("Hedging1");
var posizione1 = Positions.Find("Mylabel1");
var hedging2 =Positions.Find("Hedging2");
var posizione2 = Positions.Find("Mylabel2");
var volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);
var NOposizioni1 = hedging1 == null && posizione1 == null;
var NOposizioni2 = hedging2 == null && posizione2 == null;
var SIposizioni1 = hedging1 != null && posizione1 != null;
var SIposizioni2 = hedging2 != null && posizione2 != null;
var MediaDayDiscesa = Mv10D.Result.Last(1) > Mv10D.Result.LastValue;
var MediaDaySalita = Mv10D.Result.Last(1) < Mv10D.Result.LastValue;
var MediaOraDiscesa = Mv10H.Result.Last(1) > Mv10H.Result.LastValue;
var MediaOraSalita = Mv10H.Result.Last(1) < Mv10H.Result.LastValue;
Mv10D = Indicators.MovingAverage(EURUSDSeriesDay.ClosePrices, 10,MovingAverageType.Simple);
Mv10H = Indicators.MovingAverage(EUEUSDSeries1h.ClosePrices, 10,MovingAverageType.Simple);
while (1==1)
{
while ( NOposizioni1 && NOposizioni2)
{
while (MediaDayDiscesa && MediaOraSalita || MediaDaySalita && MediaOraDiscesa)
{
Print("wait");
//funziona bisognava cancellare il wait
}
while (MediaDayDiscesa && MediaOraDiscesa)
{
Print("vai sell");
break;
}
while (MediaDaySalita && MediaOraSalita)
{
Print("vai buy");
break;
}
break;
}
while (SIposizioni1 && SIposizioni2)
{
Print("DAJEE");
}
} } }
}
why it crash?
firemyst
12 Aug 2023, 11:20
Why have you not posted a screen capture of the error message you get when it crashes?
@firemyst