Topics
14 Sep 2014, 03:30
 3314
 2
30 Mar 2014, 19:52
 6164
 5
29 Nov 2013, 21:27
 5399
 19
Replies

getbuen
31 Mar 2014, 21:23

thanks for replaying me the trade will work on long term period 4h 1D chart more effectively than small time frames.

Buy should be open when MACD crossover its value (the blue line cross above the red line and going up )   at the same time a confirmation signal will be generated from the stochastic oscillator (the price should be over bought over 80 not below and the green cross over the red going down below the 80).

the sell is the same logic .

the are some musts

1- for sell --- price must go over the 80 to have overbought and the execution of the sell position will be  after the price went back to touch the 80 again going down so we have to wait the price go below the 80 on stochastic after it is crossed.

2 - if we are on uptrend we have to look for buy not sell and the same for sell we have to look for down trend to sell but if the market in a range it dose not matter. 


@getbuen

getbuen
30 Mar 2014, 21:03 ( Updated at: 21 Dec 2023, 09:20 )

it will be on the crossover the MACD and Stochastic 


@getbuen

getbuen
02 Dec 2013, 23:47

RE: RE: RE: RE: RE: Exit strategy

oky I  sent you my email :)

MRSV said:

getbuen said:

MRSV said:

I would be happy to help you as much i a can getbuen.

Here is my e-mail : MrSvensli@hotmail.no

thanks my friend 

1 we will use simple movingaverage  period 20

2 macd croosover 

How it works 

When the macdis below  0 and the the macd cross below the signal and the market is below the 20 moving average we sell on the second closing bar

Also we buy if the macd cross above the signal above the 0  we buy in the second green closing bar 

 

the most impotent thing in this strategy is the second closing bar  if the first bar went below the 20 moving average we will wait for the second bar to enter and most likely that bar will be the one to close the profit on  if you are scalper.

if you did not understand this I will try to provide you with pictures :) 

 

sorry for my bad English 

I will try to code it, send me an email, so i get your email. I wil send you the finished code there

 


@getbuen

getbuen
02 Dec 2013, 23:31

RE: RE: RE: Exit strategy

MRSV said:

I would be happy to help you as much i a can getbuen.

Here is my e-mail : MrSvensli@hotmail.no

thanks my friend 

1 we will use simple movingaverage  period 20

2 macd croosover 

How it works 

When the macdis below  0 and the the macd cross below the signal and the market is below the 20 moving average we sell on the second closing bar

Also we buy if the macd cross above the signal above the 0  we buy in the second green closing bar 

 

the most impotent thing in this strategy is the second closing bar  if the first bar went below the 20 moving average we will wait for the second bar to enter and most likely that bar will be the one to close the profit on  if you are scalper.

if you did not understand this I will try to provide you with pictures :) 

 

sorry for my bad English 


@getbuen

getbuen
02 Dec 2013, 23:10 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE: Exit strategy

 

 


@getbuen

getbuen
02 Dec 2013, 23:04

RE: Exit strategy

jeex said:

@getbuen Do you have a proper exit strategy when you trade manualy. Then you should robotize that strategy. Bad exits always cost more trades than bad entries.
 

// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Robot. 
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.API.Requests;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot()]
    public class MacdBot : Robot
    {
        private MacdHistogram _macd;
        private Position _position;
        private SimpleMovingAverage SMA;

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

        [Parameter("Source")]
        public DataSeries Source { get; set; }

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

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

        [Parameter("Long Cycle", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle", DefaultValue = 12)]
        public int ShortCycle { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 100)]
        public int StopLoss { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 100)]
        public int TakeProfit { get; set; }


        protected override void OnStart()
        {
            SMA = Indicators.SimpleMovingAverage(Source, Periods);
            _macd = Indicators.MacdHistogram(LongCycle, ShortCycle, Period);

        }

        protected override void OnBar()
        {
            if (Trade.IsExecuting)
                return;

            bool isLongPositionOpen = _position != null && _position.TradeType == TradeType.Buy;
            bool isShortPositionOpen = _position != null && _position.TradeType == TradeType.Sell;
            if (SMA.Result.LastValue < Symbol.Ask)
                if (_macd.Histogram.LastValue < 0.0005 && _macd.Signal.IsRising() && !isLongPositionOpen)
                {
                    ClosePosition();
                    Buy();
                }
            if (SMA.Result.LastValue > Symbol.Ask)
                if (_macd.Histogram.LastValue > 0.0005 && _macd.Signal.IsFalling() && !isShortPositionOpen)
                {
                    ClosePosition();
                    Sell();
                }
        }
        private void ClosePosition()
        {
            if (_position != null)
            {
                Trade.Close(_position);
                _position = null;
            }
        }

        private void Buy()
        {
            Trade.CreateBuyMarketOrder(Symbol, Volume);
        }

        private void Sell()
        {
            Trade.CreateSellMarketOrder(Symbol, Volume);
        }

        protected override void OnPositionOpened(Position openedPosition)
        {
            _position = openedPosition;

            double? stopLossPrice = null;
            double? takeProfitSize = null;

            if (StopLoss != 0)
            {
                if (openedPosition.TradeType == TradeType.Buy)
                {
                    stopLossPrice = openedPosition.EntryPrice - StopLoss * Symbol.PipSize;
                }
                else
                {
                    stopLossPrice = openedPosition.EntryPrice + StopLoss * Symbol.PipSize;
                }
            }

            if (TakeProfit != 0)
            {
                if (openedPosition.TradeType == TradeType.Buy)
                {
                    takeProfitSize = openedPosition.EntryPrice + TakeProfit * Symbol.PipSize;
                }
                else
                {
                    takeProfitSize = openedPosition.EntryPrice - TakeProfit * Symbol.PipSize;
                }
            }

            Trade.ModifyPosition(openedPosition, stopLossPrice, takeProfitSize);

        }

        ///
        /// Remove closed position from list
        ///

    }
}

 

try this one on 30 minutes chart and only work on EUR/USD  but even the result is good but it is not like what I want the key of this strategy is to enter on the second bar not the one which break the 20 moving average . but as you can see I played with this numbers and adjustment

  if (_macd.Histogram.LastValue < 0.0005 && _macd.Signal.IsRising() && !isLongPositionOpen)
                {
                    ClosePosition();
                    Buy();
                }
            if (SMA.Result.LastValue > Symbol.Ask)
                if (_macd.Histogram.LastValue > 0.0005 && _macd.Signal.IsFalling() && !isShortPositionOpen)
                {

if you can help please .... and I have many strategies that I can share with you if you want to make them  

 


@getbuen

getbuen
02 Dec 2013, 21:24

RE:

I modified it and it is getting better and better but can you tell me if I want to add take profit and stop loss to this and I will give you a beautiful result 

MRSV said:

// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Robot. 
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.API.Requests;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot()]
    public class MacdBot : Robot
    {
        private MacdHistogram _macd;
        private Position _position;
        private SimpleMovingAverage SMA;

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

        [Parameter("Source")]
        public DataSeries Source { get; set; }

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

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



        [Parameter("Long Cycle", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle", DefaultValue = 12)]
        public int ShortCycle { get; set; }


        protected override void OnStart()
        {
            SMA = Indicators.SimpleMovingAverage(Source, Periods);
            _macd = Indicators.MacdHistogram(LongCycle, ShortCycle, Period);

        }

        protected override void OnBar()
        {
            if (Trade.IsExecuting)
                return;

            bool isLongPositionOpen = _position != null && _position.TradeType == TradeType.Buy;
            bool isShortPositionOpen = _position != null && _position.TradeType == TradeType.Sell;
            if (SMA.Result.LastValue < Symbol.Ask)
                if (_macd.Histogram.LastValue > 0.0 && _macd.Signal.IsRising() && !isLongPositionOpen)
                {
                    ClosePosition();
                    Buy();
                }
            if (SMA.Result.LastValue > Symbol.Ask)
                if (_macd.Histogram.LastValue < 0.0 && _macd.Signal.IsFalling() && !isShortPositionOpen)
                {
                    ClosePosition();
                    Sell();
                }
        }
        private void ClosePosition()
        {
            if (_position != null)
            {
                Trade.Close(_position);
                _position = null;
            }
        }

        private void Buy()
        {
            Trade.CreateBuyMarketOrder(Symbol, Volume);
        }

        private void Sell()
        {
            Trade.CreateSellMarketOrder(Symbol, Volume);
        }

        protected override void OnPositionOpened(Position openedPosition)
        {
            _position = openedPosition;
        }

    }
}

 

Still doesn't seem very profitable

 


@getbuen

getbuen
02 Dec 2013, 16:50

RE: http://ctdn.com/algos/robots/show/155

:( I don't know how to make this out .if I know how to code this I wont have topic here 

jeex said:

Sorry, i never share my bots or indicators. However you may try this one and alter it by adding a simple SMA 20

/algos/robots/show/155

 

 


@getbuen

getbuen
02 Dec 2013, 15:44 ( Updated at: 21 Dec 2023, 09:20 )

RE: Results, what a surprise...

thanks for replying me and  about the strategy can you give me the code to try it and develop it  and I will reply the result to you 

jeex said:

Not surprising that life can't be this simple. The results with:

  • Zero Spread!
  • Zero Commission!
  • 5 pips  SL and TP

With higher SL and TP it got even worse. As sometimes there are over 5 trades losing, so martingale is out of the question. A better Exit strategy might make the results better. But the most important problems as always with these MacDonalds strategies are:

  • the big spikes have already occured when the robot steps in
  • there are many trade moments within the algo, where the human eye would know better

EURUSD

GBPJPY

 


@getbuen

getbuen
29 Nov 2013, 22:58 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

AGAIN SOME PROOFS

 


@getbuen

getbuen
29 Nov 2013, 22:51 ( Updated at: 21 Dec 2023, 09:20 )

RE:

THIS IS AN EXAMPLE 

getbuen said:

Hello evey one and sorry for my bad english but I will try . Can any one help to build roobot that will get you alot of money 

1 we will use simple movingaverage  period 20

2 macd croos over 

3 time 5 minutes

How it works 

When the macdis below  0 and the the macd cross below the signal and the market is below the 20 moving average we sell on the secound closing bar

Also we buy if the macd cross abovw the signal above the 0  we buy in the secound green closing bar 

Please can any one help me to make this roobots . I AM GAINING MONEY WITH THIS STRATEGY BUT SOMTIMES THE MARKET IS MOVING FASTER THAN ME 

 


@getbuen