Usain Bot - Day Trader free

by willbs in category Trend at 08/01/2023
Description

The most faster Bot for Day Trader

Indicators in Bot: RSI + ParabolicSAR + OBV
With Trailing Stop

Bot close positions if has been open for more than 2 hour.

Bot open new positions only between 6AM and 7PM (server hour).

Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
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 SampleRSIRobot : Robot
{
[Parameter("Source")]
public DataSeries Source { get; set; }

[Parameter("Periods", DefaultValue = 14)]
public int Periods { get; set; }

[Parameter("ParabolicSAR Acceleration", DefaultValue = 0.02, MinValue = 0.01, MaxValue = 0.3)]
public double Acceleration { get; set; }

[Parameter("ParabolicSAR Maximum", DefaultValue = 0.2, MinValue = 0.01, MaxValue = 0.3)]
public double Maximum { get; set; }

[Parameter("OBV Periods", DefaultValue = 14)]
public int OBVPeriods { get; set; }

[Parameter("Trailing Stop (pips)", DefaultValue = 10, MinValue = 1)]
public int TrailingStop { get; set; }

[Parameter("Volume", DefaultValue = 1000, MinValue = 1000)]
public int Volume { get; set; }

private RelativeStrengthIndex rsi;
private ParabolicSAR parabolicSAR;
private OnBalanceVolume obv;

protected override void OnStart()

{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
parabolicSAR = Indicators.ParabolicSAR(Acceleration, Maximum);
obv = Indicators.OnBalanceVolume(Source);
}

protected override void OnTick()
{
var parabolicSARTrend = parabolicSAR.Result.Last(1);

DateTime currentTime = Server.Time;
double currentPrice = Symbol.Bid;
int currentHour = currentTime.Hour;

if (currentHour < 6 || currentHour >= 19)
{
    return;
}

foreach (var position in Positions)
{
    TimeSpan timeSinceOpen = currentTime - position.EntryTime;

    
    // Check if the position has been open for more than 2 hour
if (timeSinceOpen.TotalMinutes > 240)
{
    ClosePosition(position);
    continue;
}

if (position.TradeType == TradeType.Buy)
{
    var trailingStop = position.EntryPrice - Symbol.PipSize * TrailingStop;

    if (position.StopLoss == null || position.StopLoss < trailingStop)
    {
        ModifyPosition(position, trailingStop, position.TakeProfit);
    }
}
else if (position.TradeType == TradeType.Sell)
    {
        var trailingStop = position.EntryPrice + Symbol.PipSize * TrailingStop;

        if (position.StopLoss == null || position.StopLoss > trailingStop)
        {
            ModifyPosition(position, trailingStop,position.TakeProfit);
        }
    }
}
    
    if (rsi.Result.LastValue < 30 && parabolicSAR.Result.LastValue < currentPrice && obv.Result.LastValue > obv.Result.Last(2))
{
Close(TradeType.Sell);
Open(TradeType.Buy);
}
else if (rsi.Result.LastValue > 70 && parabolicSAR.Result.LastValue > currentPrice && obv.Result.LastValue < obv.Result.Last(2))
{
Close(TradeType.Buy);
Open(TradeType.Sell);
}
}
private void Close(TradeType tradeType)
{
    foreach (var position in Positions.FindAll("SampleRSI", SymbolName, tradeType))
ClosePosition(position);
}
private void Open(TradeType tradeType)
{
var position = Positions.Find("SampleRSI", SymbolName, tradeType);
if (position == null)
{
    //Print(StopLoss);
    var result = ExecuteMarketOrder(tradeType, SymbolName, Volume, "SampleRSI", stopLossPips: TrailingStop, takeProfitPips: null);



    if (result.IsSuccessful)
    {
        position = result.Position;
    }
}
}
}
}
Comments

kosay94072 - January 12, 2023 @ 19:42

All very competently written and understandable to any person who does not know the topic as well as knowledge about rtp

wjennife113 - January 16, 2023 @ 10:44

It's difficult to predict the future because of the interconnected nature of events and the choices you make today. Bitlife is a game where you can become either the most successful person on the planet or a complete failure, depending on your choices. Live out a plausible story from the moment of your birth till your final breath!
 

wonrya6660 - January 17, 2023 @ 04:54

Your information is highly factual, and it provides me with the knowledge I need to study, madalin stunt cars is a famous racing game, join if you also want to experience

0