daemon's avatar
daemon
daemon's avatar

Info

Username:daemon
Name:daemon
Member since: 30 Aug 2012

Favorite symbols:

EURUSD

About

None

Signature

None

Last Forum Posts

@Ichimoku cloud breakout Bot:  27 Jan 2014, 17:49


Hi This is how to open a long position. The rest of the code for the short is similar. You can also find examples on trailing stop and break even here on the forum.

I used the Ichimoku Cloud from here. 

/*
 *  that enters a long position if:
The last candle closed above the kumo (cloud)
But only if:
It opened inside or on the opposite side of the kumo and
It is currently no more than 30 pips away from the kumo.
(Opposite requirements for a short position).
 */

using cAlgo.API;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class IchimokouBot : Robot
    {
        private IchimokuCloud ichimoku;
        [Parameter(DefaultValue = 9)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 26)]
        public int periodMedium { get; set; }

        [Parameter(DefaultValue = 52)]
        public int periodSlow { get; set; }

        [Parameter(DefaultValue = 26)]
        public int DisplacementCloud { get; set; }

        [Parameter(DefaultValue = "MyLabel")]
        public string MyLabel { get; set; }

        [Parameter(DefaultValue = 10000)]
        public int Volume { get; set; }

        [Parameter("Stop Loss", DefaultValue = 25, MinValue = 0, MaxValue = 100)]
        public int StopLossPips { get; set; }

        [Parameter("Take Profit", DefaultValue = 20, MinValue = 0, MaxValue = 100)]
        public int TakeProfitPips { get; set; }


        protected override void OnStart()
        {
            ichimoku = Indicators.GetIndicator(periodFast, periodMedium, periodSlow, DisplacementCloud);
        }

        protected override void OnBar()
        {
            var closedAbove = MarketSeries.Close.Last(1) > ichimoku.SenkouSpanA.Last(1);
            var openedInsideKumo = MarketSeries.Open.Last(1) <= ichimoku.SenkouSpanA.Last(1) &&
                                   MarketSeries.Open.Last(1) >= ichimoku.SenkouSpanB.Last(1);
            var distanceFromKumo = (MarketSeries.Close.LastValue - ichimoku.SenkouSpanA.LastValue)/Symbol.PipSize;

            if (closedAbove && openedInsideKumo && distanceFromKumo <= 30)
                ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, MyLabel, StopLossPips, TakeProfitPips);

        }

    }
}

@MACD Histogram Last Value:  27 Jan 2014, 16:27


Which values are you looking at exactly on the chart? You can use the market snapshot tool and look at the value for the Histogram Main. The signal would be the line not the histogram.  Maybe test the previous value since the last value would be the current value which constantly changes with new ticks. You can confirm the price by testing the previous bar value. 

@Risk based lot sizes:  21 Jan 2014, 14:02


It seems I have the wrong files because I cannot move the lines prior to submit. But anyway, I don't think I can code it. I can just calculate the lot based on risk and SL/TP input.

@Risk based lot sizes:  21 Jan 2014, 12:51


Maybe I'm missing something in the usage or perhaps I don't have the right files. I don't get how the lot size is calculated from the dragable lines. Only the SL and TP are modified if I drag the lines.

@Risk based lot sizes:  21 Jan 2014, 10:31


Do you want the lot calculation or the whole system because with cTrader you can modify the sl/tp by dragging the lines with out scripts. I think I can make a robot to place trades based on that and then you can use cTrader to drag the sl/tp lines or price for pending orders. Let me know if there is something I missed.

Quote from forexfactory:

I made this simple tool to give me the ability to specify sl/tp for new order by using mouse (dragging line object). Input sl/tp manually is a boring task, especially for lazy trader.
It also monitor existing trade sl/tp, which means it will modify existing sl/tp and open price (for pending order) when it detected a different value between order's sl/tp and the corresponding sl/tp line object.
Other feature : 
- lot size calculated automatically based on the specified risk.
- a simple popup menu that allows you to quickly close an order based on ticket number
Unlike most line object based trading tools, this program doesn't use EA for monitoring lines object every tick, or a script which uses continuous looping with certain delay. It detects mouse dragging activities (hence why it uses dll) and fire the necessary script. All script will return once its job (opening new order / modifying existing orders) finished.

@How to draw a line?:  31 Dec 2013, 09:36


 ChartObjects.DrawHorizontalLine("line", Symbol.Bid, Colors.Red);

/api/reference/internals/chartobjects/drawhorizontalline-738f

@Backtesting with data from CSV file:  31 Dec 2013, 09:24


cogs said:

I get this error, any suggestions?

Remove the first column and probably the first row.

The example in the first page is:

2003.06.18,16:01,1.11423,1.11428,1.11332,1.11374,19
2003.06.18,16:02,1.11364,1.11436,1.11361,1.11405,7
2003.06.18,16:03,1.11402,1.11455,1.11400,1.11440,5
2003.06.18,16:04,1.11446,1.11461,1.11401,1.11447,14

@Backtesting with data from CSV file:  27 Dec 2013, 14:51


You can right click -> Format Cells (highlight the column) the choose the format with the period.

@Close all positions with profitable takeprofit:  10 Dec 2013, 09:29


it should be the way hichem said. Commisions and swap are negative.

Cerunnos said:

Shouldn't be:

sum += position.NetProfit - position.Swap

or

sum += position.GrossProfit - position.Commissions - position.Swap


Or not?

@Close all positions with profitable takeprofit:  09 Dec 2013, 18:06


Wait, Shouldn't it be:

sum += position.NetProfit - position.Commisions - positions.Swap;
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.
Coral
  1
  3.75
  5841
by daemon
free  14 Sep 2012
Coral is a nice trend indicator that displays change in trend. Useful for entries and exits.  
QQE
  3
  5
  6407
by daemon
free  01 Sep 2012
A combination of Exponential Moving Average and Relative Strength Index. Go Long when QQE is rising, exit and sell when QQE is falling and vice versa.    
DiNapoli Detrend
  1
  5
  3090
by daemon
free  31 Aug 2012
DiNapoli Detrended Price Oscilator.  
Preferred Stochastic
  1
  5
  4210
by daemon
free  31 Aug 2012
Dinapoli's Preferred Stochastic Oscilator.    
MACD DiNapoli
  0
  5
  4194
by daemon
free  31 Aug 2012
This is the DiNapoli version of MACD.  It is recomended to use it with a stochastic oscillator in his book, " Trading With DiNapoli".    
by daemon
free  30 Aug 2012
Adaptive Laguerre Filter from John Ehlers book "Cybernetic Analysis for Stocks and Futures".  
Trend Indicator
  5
  5
  4608
by daemon
free  30 Aug 2012
Based on Instantaneous Trend from  John Ehlers book "Cybernetic Analysis for Stocks and Futures".  
Hilbert Transform
  0
  5
  2631
by daemon
free  30 Aug 2012
Hilbert Transform from Ehlers book "Cybernetic Analysis for Stocks and Futures"  
LaguerreWMA
  0
  5
  2936
by daemon
free  30 Aug 2012
Laguerre polynomial smothed with a weighted moving average and it's exponential moving average as Trigger. The histogram shows their difference.       
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
SMA 252
  4
  0
  4553
by daemon
free  14 Sep 2012
Opens a Long position when sma crosses below the trend bars and a short position if it crosses above. One position open at a time.  Works best with Timeframes H1 and above. Good Luck!