Information
Username: | p.thaisup |
Member since: | 15 Jan 2018 |
Last login: | 15 Jan 2018 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 2 |
Forum Topics | 0 | 0 |
Jobs | 0 | 0 |
Last Algorithm Comments
Some one can help me add stop lost in this robot, I try to add this codes but it doesn't work
// -------------------------------------------------------------------------------------------------
//
// This code is a cAlgo API sample.
//
// This cBot is intended to be used as a sample and does not guarantee any particular outcome or
// profit of any kind. Use it at your own risk
//
// The "Sample Martingale cBot" creates a random Sell or Buy order. If the Stop loss is hit, a new
// order of the same type (Buy / Sell) is created with double the Initial Volume amount. The cBot will
// continue to double the volume amount for all orders created until one of them hits the take Profit.
// After a Take Profit is hit, a new random Buy or Sell order is created with the Initial Volume amount.
//
// -------------------------------------------------------------------------------------------------
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class HedgingandScalpingAlgo : Robot
{
[Parameter("Stop Loss", DefaultValue = 10)]
public int StopLoss { get; set; }
protected override void OnStart()
{
[Parameter("Volume", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
public int Volume { get; set; }
protected override void OnStart()
{
}
protected override void OnBar()
{
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume,StopLoss ,0, "BUY");
ExecuteMarketOrder(TradeType.Sell, Symbol, Volume,StopLoss ,0,0 "SELL");
foreach (var position in Positions)
{
if (position.Pips > 2)
{
ClosePosition(position);
}
}
}
}
}
It alot of Drowdown 100%
if we can make minimum just 20-30% it could be run on real account soon.