Skip to content

Instantly share code, notes, and snippets.

View Waxavi's full-sized avatar
🏠
Working from home

Xavier Waxavi

🏠
Working from home
  • Freelancer
  • 127.0.0.1
View GitHub Profile
@Waxavi
Waxavi / PivotsNinjaTrader.cs
Last active April 10, 2025 22:43
Simple Pivots NinjaTrader
// Function to detect pivot pattern with variable left and right bars
// We're assuming that if we're using onTick, the signal may end up being false
// Therefore the point will need to be deleted if the signal switches from true to false
public bool IsPivotHigh(int leftBars, int rightBars)
{
//if you want to ensure that when using ontick the signal doesn't flare up and down
//so that there will be no need to be deleted, shift the signal one bar
//(skip the one that is being developed) and use this offset
//int offset = Calculate == Calculate.OnBarClose ? 0 : 1;
@Waxavi
Waxavi / gist:98ca0194a3849daf1baf7279d3923cab
Created July 7, 2023 19:40
Simple Time Filter for cTrader
//#region TimeFilter
//[Parameter("Use Time Filter", DefaultValue = false, Group = "Filters - Time")]
//public bool InputUseTimeFilter { get; set; }
//[Parameter("Time Start", DefaultValue = "00:00", Group = "Filters - Time")]
//public string InputTimeFilterStart { get; set; }
//[Parameter("Time End", DefaultValue = "08:00", Group = "Filters - Time")]
//public string InputTimeFilterEnd { get; set; }
@Waxavi
Waxavi / TrailingStop.cs
Created February 23, 2023 20:06
Trailing Stop
// [Parameter("Use Trailing Stop", DefaultValue = false)]
// public bool InputUseTrailingStop { get; set; }
//
// [Parameter("Trailing Stop Trigger", DefaultValue = 10)]
// public double InputTrigger { get; set; }
//
// [Parameter("Trailing Stop", DefaultValue = 5)]
// public double InputTrailingStop { get; set; }
//_label is the label used for the positions
@Waxavi
Waxavi / VolumeTools.cs
Created January 13, 2023 22:28
VolumeAtRisk in cTrader
using cAlgo.API.Internals;
namespace MyUtilities
{
public static class VolumeTools
{
public static double VolumeAtRisk(Symbol symbol, double balance, double riskPct, double sl)
{
//Print($"Amount to Risk {Account.Balance * (riskPct / 100.0)} with a SL {sl} * PipValue of {sl * symbol.PipValue}");
@Waxavi
Waxavi / UsefulFunctions.mq4
Created November 19, 2018 05:09
MQL4 Useful Functions
//+------------------------------------------------------------------+
//| UsefulFunctions.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+