Description
- This cBots works with EURUSD, AUDUSD, EURAUD, EURGBP, GBPUSD, NZDUSD, USDCAD, USDCHF, USDJPY
- TimeFrame 4h
- Not use StopLoss and for this reason you need to set lots carefully
Here some example screen of backtesting
Here the settings
- EurUsd
- takeProfit: 15
- stopLoss: 100000
- hourEnter: 2
- hourExit: 23
- fastPeriod: 55
- slowPeriod: 250
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 19
- stochParams: 2
- AudUsd
- takeProfit: 7
- stopLoss: 100000
- hourEnter: 5
- hourExit: 19
- fastPeriod: 45
- slowPeriod: 210
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 16
- stochParams: 2
- EurAud
- takeProfit: 31
- stopLoss: 100000
- hourEnter: 6
- hourExit: 20
- fastPeriod: 65
- slowPeriod: 250
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 23
- stochParams: 6
- EurGbp
- takeProfit: 19
- stopLoss: 100000
- hourEnter: 2
- hourExit: 23
- fastPeriod: 45
- slowPeriod: 260
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 7
- stochParams: 2
- GbpUsd
- takeProfit: 15
- stopLoss: 100000
- hourEnter: 0
- hourExit: 21
- fastPeriod: 45
- slowPeriod: 110
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 9
- stochParams: 3
- NzdUsd
- takeProfit: 9
- stopLoss: 100000
- hourEnter: 9
- hourExit: 23
- fastPeriod: 20
- slowPeriod: 210
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 19
- stochParams: 3
- UsdCad
- takeProfit: 11
- stopLoss: 100000
- hourEnter: 9
- hourExit: 18
- fastPeriod: 25
- slowPeriod: 240
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 24
- stochParams: 3
- UsdChf
- takeProfit: 17
- stopLoss: 100000
- hourEnter: 8
- hourExit: 19
- fastPeriod: 45
- slowPeriod: 260
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 17
- stochParams: 5
- UsdJpy
- takeProfit: 8
- stopLoss: 100000
- hourEnter: 4
- hourExit: 17
- fastPeriod: 50
- slowPeriod: 130
- lots: check in lots section
- maxOrder: 2 (depends how many MAX orders you want to have open in the same time)
- stochLength: 15
- stochParams: 3
Lots to use by your account balance:
- from: 100$ to: 500$ use 0.01 lots
- from: 500$ to: 1.000$ use 0.03 lots
- from: 1.000$ to: 2.000$ use 0.06 lots
- from: 2.000$ to: 5.000$ use 0.1 lots
- from: 5.000$ to: 10.000$ use 0.3 lots
- from: 10.000$ to: 15.000$ use 0.5 lots
- from: 15.000$ to: 20.000$ use 1 lots
- from: 20.000$ + use 2 lots and add 1 lot for each 10k
To respect this rules it's important for your money management! Don't rush, let the money work for you!
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.UTC, AccessRights = AccessRights.None)]
public class IIScalping : Robot
{
[Parameter("Source", Group = "Data series")]
public DataSeries Source { get; set; }
[Parameter(DefaultValue = 10)]
public double takeProfit { get; set; }
[Parameter(DefaultValue = 10)]
public double stopLoss { get; set; }
[Parameter(DefaultValue = 8)]
public int hourEnter { get; set; }
[Parameter(DefaultValue = 18)]
public int hourExit { get; set; }
[Parameter(DefaultValue = 60)]
public int fastPeriod { get; set; }
[Parameter(DefaultValue = 240)]
public int slowPeriod { get; set; }
[Parameter(DefaultValue = 0.01)]
public double lots { get; set; }
[Parameter(DefaultValue = 1)]
public int maxOrder { get; set; }
[Parameter(DefaultValue = 8)]
public int stochLength { get; set; }
[Parameter(DefaultValue = 3)]
public int stochParams { get; set; }
private ExponentialMovingAverage emaFast;
private ExponentialMovingAverage emaSlow;
private StochasticOscillator stoch;
double stochLevel = 0.0;
protected override void OnStart()
{
// Put your initialization logic here
}
protected override void OnBar()
{
// Put your core logic here
emaFast = Indicators.ExponentialMovingAverage(Source, fastPeriod);
emaSlow = Indicators.ExponentialMovingAverage(Source, slowPeriod);
stoch = Indicators.StochasticOscillator(stochLength, stochParams, stochParams, MovingAverageType.Exponential);
int currentBar = Bars.Count - 1;
bool check = checkTime();
var positions = Positions.FindAll("Order");
if (check == true)
{
//Open(TradeType.Buy, lots);
if(emaFast.Result.LastValue > emaSlow.Result.LastValue && stoch.PercentK[currentBar] > stoch.PercentD[currentBar] && stoch.PercentK[currentBar - 1] <= 20 && stochLevel == 0.0){
stochLevel = Bars.LastBar.Close;
}
if(emaFast.Result.LastValue < emaSlow.Result.LastValue && stoch.PercentK[currentBar] < stoch.PercentD[currentBar] && stoch.PercentK[currentBar - 1] >= 80 && stochLevel == 0.0){
stochLevel = Bars.LastBar.Close;
}
if (emaFast.Result.LastValue > emaSlow.Result.LastValue && stoch.PercentK[currentBar] > stoch.PercentD[currentBar] && stoch.PercentK[currentBar - 1] <= 20 && Bars.LastBar.Close > stochLevel)
{
stochLevel = 0.0;
//stopLoss = (Bars[currentBar-1].Close - Bars[currentBar-1].Low)*100000;
Open(TradeType.Buy, lots);
}
if (emaFast.Result.LastValue < emaSlow.Result.LastValue && stoch.PercentK[currentBar] < stoch.PercentD[currentBar] && stoch.PercentK[currentBar - 1] >= 80 && Bars.LastBar.Close < stochLevel)
{
stochLevel = 0.0;
//stopLoss = (Bars[currentBar-1].High - Bars[currentBar-1].Close)*100000;
Open(TradeType.Sell, lots);
}
}
if(positions.Length>0 && (positions[0].TradeType == TradeType.Buy)){
if(stoch.PercentK[currentBar] >= 80){
Close(TradeType.Buy);
}
}
if(positions.Length>0 && (positions[0].TradeType == TradeType.Buy)){
if(stoch.PercentK[currentBar] <= 20){
Close(TradeType.Sell);
}
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
private bool checkTime()
{
DateTime date = Server.Time;
if (date.Hour >= hourEnter && date.Hour <= hourExit)
{
return true;
}
else
{
return false;
}
}
private void Close(TradeType tradeType)
{
foreach (var position in Positions.FindAll("Order", SymbolName, tradeType))
ClosePosition(position);
}
private void Open(TradeType tradeType, double lots)
{
var position = Positions.FindAll("Order", SymbolName, tradeType);
var volumeInUnits = Symbol.QuantityToVolumeInUnits(lots);
if (position == null || position.Length < maxOrder)
ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "Order", stopLoss, takeProfit);
}
}
}
DR
drilonhametaj
Joined on 22.12.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Investo Investigando - Stoch ordinato + 3EMA.algo
- Rating: 5
- Installs: 1678
- Modified: 22/12/2022 18:09
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.
Everything is very open and honest, and the challenges are broken down in great detail. The information is without a doubt beneficial to have. Is my website extremely successful in terms of making money? Please take a look at this: trap the cat