I need conversion or rewrtiting of below Acttrader Strategy Code to a MQ4 EA

Работа завершена

Время выполнения 5 часов
Отзыв от заказчика
I have received what i asked for and more. very solid work.

Техническое задание


The strategy is quite simple as It uses two charts. The first 'Slow candle history' chart determines a trend, and the other 

'Fast candle chart' chart is used for moving average to enter in a market when the MA crosses a calculated signal price. if a close rate of 

previous candle from 'slow candle history' chart is closed above the open price of the candle, then the market is bullish. If a close rate of 

previous candle from 'slow candle history' chart is closed below the open price of the candle, then the market is bearish. 

The strategy calculates a size of previous candle from 'slow candle history' chart. After that the strategy takes the percentage 

part of that size and subtracts it from the open rate of the candle. As a result the strategy gets a signal price. 

When the moving average crosses the signal price the strategy will open a position. If the signal price is crossed from top to bottom the strategy 

will open a buy position. And vise versa if the signal price is crossed from bottom to top, the strategy will open a sell position.

Maximum currently opened positions are no more then one


The strategy settings:

'% of Slow Previous Bar Size' - percentage part of the previous candle from 'slow candle history' chart.


The strategy uses the following formula:

diff = previous_close_price - previous_open_price (from 'slow candle history' chart) ;

a = diff * Percentage_part;

signal_price = today_open_price - a;


there are defined s/l n t/p and prevention of opening more than one position at a time in below existing ActTrader script 

 

i would like to add some advanced  features regarding money preservation and runing profit optimisation instead of as now fixed s/l t/p. this can be done in a second step as i do have some code tht othewise works well


ACTTRADER SCRIPT WORKING:


const

StrategyName = 'super_combat'; 

StrategyVersion = '1.0'; 


var

SlowHistory, FastHistory: TCandleHistory; 

Account: TAccount;

Amount, Amount_sell, Percent: Double;

MA:TIndicatorScript; 

MA_set:TMovingAverage;

Stop, Limit, TraderRange:integer;

//////////////////////////////////////////////////////////////////////////////////////////////////////

procedure OnCreate;

begin

Settings.AddCandleHistory(@SlowHistory, 'Slow Candle History', '', CI_1_Day, 10);

Settings.AddCandleHistory(@FastHistory, 'Fast Candle History', '', CI_1_Hour, 100); 

FastHistory.OnNewCandleEvent:= @OnNewCandle;

FastHistory.OnNewRateEvent:= @OnNewRate; 

Settings.AddAccount(@Account, 'Account', ''); 

Settings.AddFloat(@Amount, 'Buy Amount (lots)', 1); 

Settings.SetFloatRestrictions(@Amount, 0, 10000, 1);

Settings.AddFloat(@Amount_sell, 'Sell Amount (lots)', 1);

Settings.SetFloatRestrictions(@Amount_sell, 0, 10000, 1);

Settings.AddFloat(@Percent, '% of Slow Previous Bar Size', 25); 

Settings.SetFloatRestrictions(@Amount, 0, 100, 1);

Settings.AddInteger(@Stop, 'Stop (pips)', 20); 

Settings.SetIntegerRestrictions(@Stop, 0, 10000, 1);

Settings.AddInteger(@Limit, 'Limit (pips)', 60); 

Settings.SetIntegerRestrictions(@Limit, 0, 10000, 1);

Settings.AddInteger(@TraderRange, 'Trader Range', 2); 

Settings.SetIntegerRestrictions(@TraderRange, 0, 10000, 1);

MA:= TIndicatorScript.Create(FastHistory, 'Moving Average', 'Moving Average');

MA_set:= MA.VariableValue('MA'); 

MA_set.Period := 1; 

MA_set.AverageType := makSimple; 

MA_set.CalculationType := cbClose;

end;

//////////////////////////////////////////////////////////////////////////////////////////////////////

procedure OnNewRate;

var signal_rate:double;

begin

signal_rate:= SlowHistory.Last(0).Open - ((SlowHistory.Last(1).Close - SlowHistory.Last(1).Open) * (Percent / 100));

if (MA.GetGraph(0).Last(1) > signal_rate) and (MA.GetGraph(0).Last(0) < signal_rate) and (NoPositions(bsBuy)) then begin 

CreateOrder(FastHistory.Instrument, Account, Amount, bsBuy,

FastHistory.Instrument.Sell - Stop * FastHistory.Instrument.PointSize,

FastHistory.Instrument.Sell + Limit * FastHistory.Instrument.PointSize, TraderRange, StrategyName);

log('buy signal rate = ' + FloatToStr(signal_rate));

end; 

if (MA.GetGraph(0).Last(1) < signal_rate) and (MA.GetGraph(0).Last(0) > signal_rate) and (NoPositions(bsSell)) then begin

CreateOrder(FastHistory.Instrument, Account, Amount_sell, bsSell,

FastHistory.Instrument.Buy + Stop * FastHistory.Instrument.PointSize,

FastHistory.Instrument.Buy - Limit * FastHistory.Instrument.PointSize, TraderRange, StrategyName);

log('sell signal rate = ' + FloatToStr(signal_rate));

end; 

end;

//////////////////////////////////////////////////////////////////////////////////////////////////////

// Defines is there any open Sell/Buy positions, opened by this strategy 

function NoPositions(pos:TBuySell): boolean;

var i:integer;

begin

result:= true; 

for i:= TradeList.Count-1 downto 0 do 

if (TradeList.Get(i).Tag = StrategyName) and (TradeList.Get(i).BuySell = pos) then 

result:= false;

end;

////////////////////////////////////////////////////////////////////////////////////////////////////// 

Откликнулись

1
Разработчик 1
Оценка
(336)
Проекты
620
38%
Арбитраж
39
23% / 64%
Просрочено
93
15%
Свободен
2
Разработчик 2
Оценка
(1)
Проекты
2
0%
Арбитраж
1
0% / 100%
Просрочено
1
50%
Свободен
3
Разработчик 3
Оценка
(62)
Проекты
140
46%
Арбитраж
19
42% / 16%
Просрочено
32
23%
Свободен
4
Разработчик 4
Оценка
(71)
Проекты
254
53%
Арбитраж
16
50% / 38%
Просрочено
83
33%
Свободен
5
Разработчик 5
Оценка
(3)
Проекты
5
20%
Арбитраж
1
100% / 0%
Просрочено
3
60%
Свободен
6
Разработчик 6
Оценка
(548)
Проекты
825
73%
Арбитраж
15
53% / 13%
Просрочено
193
23%
Работает
7
Разработчик 7
Оценка
(272)
Проекты
394
63%
Арбитраж
70
53% / 26%
Просрочено
198
50%
Свободен
8
Разработчик 8
Оценка
(795)
Проекты
1365
72%
Арбитраж
112
29% / 48%
Просрочено
341
25%
Работает
9
Разработчик 9
Оценка
(9)
Проекты
18
22%
Арбитраж
3
67% / 33%
Просрочено
4
22%
Свободен
Похожие заказы
Hello, I am looking for an experienced and professional developer to create a trade copier that transfers trades from MetaTrader 5 (MT5) to NinjaTrader 8 (NT8). I am looking for a developer with a strong track record in creating MT5 to NT8 trade copiers and who can deliver a robust and reliable solution. Thank you, and I look forward to your proposals
Hi there ,I am seeking for some who can I integrate MT4+MT5 into Matlab!We need our indicator window of MT4+MT5 viewable in Matlab so we can execute more research on Matlab Best regards Richie
I wan to oder a product for copytrade online like that : - master on mt4 - slaver (copier) by python that mean MT4 open an oder, python will open the same on client account => python will click the mouse then results will show manual (not expert) value : autolot (ratio with receiver balance) - fixed lot - Smart ratio (ratio with master account) trade on many pairs get source for manage license hide everything that
We trading using C# application running via API https://www.mtsocketapi.com to send orders and some other commands to MT5. We have to read UT bot alert indicator in our C# application
I NEED TO HAVE MY INDICATOR CONVERTED TO PINESCRIPT. IF YOU CHARGE PER LINES PLEASE ADVISE ALSO I NEED THIS DONE QUICKLY. IF YOU ARE ABLE FINISH WITHIN A DAY OR 2 PLEASE APPLY. THE INDICATOR IS BASED OFF ZIG ZAG AND RSI

Информация о проекте

Бюджет