Skip to content

Commit

Permalink
1.076 Added loop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoCiaccio committed Aug 19, 2022
1 parent d526fb9 commit 5af1f78
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Binary file modified Extend cBot.algo
Binary file not shown.
22 changes: 19 additions & 3 deletions Extend cBot/Extend cBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ExtendcBot : Strategy

public const string NAME = "Extend cBot";

public const string VERSION = "1.075";
public const string VERSION = "1.076";

#endregion

Expand All @@ -56,6 +56,9 @@ public class ExtendcBot : Strategy

#region Strategy

[Parameter("Loop Mode", Group = "Strategy", DefaultValue = Extensions.LoopMode.OnTick)]
public Extensions.LoopMode MyLoopMode { get; set; }

[Parameter("Open Trade Type", Group = "Strategy", DefaultValue = Extensions.OpenTradeType.Buy)]
public Extensions.OpenTradeType MyOpenTradeType { get; set; }

Expand Down Expand Up @@ -248,7 +251,7 @@ public void StrategyInitialize()

public void StrategyRun()
{

bool UsingRecovery = UseDM && DMMultiplier > 0 && ConsecutiveLoss > 0;
bool SharedConditions = !IAmInPause && !UsingRecovery && !OpenedInThisBar && StrategyPositions.Length < MaxTrades && Bars.LastGAP(Symbol.Digits) <= Symbol.PipsToDigits(GAP) && Symbol.RealSpread() <= SpreadToTrigger;

Expand Down Expand Up @@ -312,6 +315,8 @@ protected override void OnStart()

StrategyInitialize();

if (MyLoopMode == Extensions.LoopMode.OnTimer) Timer.Start(1);

}

protected override void OnTick()
Expand Down Expand Up @@ -409,7 +414,7 @@ protected override void OnTick()

}

StrategyRun();
if(MyLoopMode == Extensions.LoopMode.OnTick) StrategyRun();

}

Expand All @@ -418,6 +423,17 @@ protected override void OnBar()

OpenedInThisBar = false;

if (MyLoopMode == Extensions.LoopMode.OnBar) StrategyRun();

}

protected override void OnTimer()
{

base.OnTimer();

StrategyRun();

}

protected override void OnStop()
Expand Down
9 changes: 9 additions & 0 deletions Extend cBot/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ public enum OpenTradeType

}

public enum LoopMode
{

OnTick,
OnBar,
OnTimer

}

#endregion

#region Helper
Expand Down

0 comments on commit 5af1f78

Please sign in to comment.