Skip to content

Commit

Permalink
1.0.1 First public release
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoCiaccio committed Jun 4, 2022
1 parent bf5a26a commit 77bd7f2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
MIT License

Copyright (c) 2017 until Today Leonardo Ciaccio

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Contact ctrader.guru@gmail.com before distribute your copy
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Trigger


[Find more indicators, cbots and tools](https://ctrader-guru.github.io)
Binary file added Trigger.algo
Binary file not shown.
41 changes: 22 additions & 19 deletions Trigger/Trigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum Logical

public const string NAME = "Trigger";

public const string VERSION = "1.0.0";
public const string VERSION = "1.0.1";

#endregion

Expand Down Expand Up @@ -106,15 +106,9 @@ public enum Logical

#region Property

int LastIndex = -1,
CountCandle = 0
;
int LastIndex = -1, CountCandle = 0;

bool
AlertInThisBar = true,
IsANewBar = false,
AllowToTrigger = true
;
bool AlertInThisBar = true, IsANewBar = false, AllowToTrigger = true;


#endregion
Expand All @@ -126,7 +120,8 @@ protected override void Initialize()

Print("{0} : {1}", NAME, VERSION);

if (!WebhookEnabled) return;
if (!WebhookEnabled)
return;

EndPoint = EndPoint.Trim();
if (EndPoint.Length < 1)
Expand Down Expand Up @@ -170,7 +165,8 @@ public override void Calculate(int index)

CountCandle++;

if (CountCandle % MonitorReset == 0) AllowToTrigger = true;
if (CountCandle % MonitorReset == 0)
AllowToTrigger = true;

}
else
Expand All @@ -191,7 +187,8 @@ public override void Calculate(int index)

case Monitoring.Bar:

if (IsANewBar) {
if (IsANewBar)
{

PerformeFirstLogic(1);
PerformeSecondLogic(1);
Expand All @@ -218,15 +215,16 @@ public override void Calculate(int index)
private void PerformeFirstLogic(int index = 0)
{

if (!FirstLogicEnabled) return;
if (!FirstLogicEnabled)
return;

switch (What)
{

case Logical.Major:

if (SourceC > 0 && SourceA.Last(index) > SourceC && SourceA.Last(index + 1) <= SourceC)
TriggerNow("first logic, 'A' is greater than the 'C'");
TriggerNow("first logic, 'A' is greater than the 'C'");
else if (SourceA.Last(index) > SourceB.Last(index) && SourceA.Last(index + 1) <= SourceB.Last(index + 1))
TriggerNow("first logic, 'A' is greater than the 'B'");

Expand Down Expand Up @@ -275,7 +273,8 @@ private void PerformeFirstLogic(int index = 0)
private void PerformeSecondLogic(int index = 0)
{

if (!SecondLogicEnabled) return;