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

MQL4 Experts Integration

Job finished

Execution time 5 hours
Feedback from customer
I have received what i asked for and more. very solid work.

Specification


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;

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

Responded

1
Developer 1
Rating
(336)
Projects
620
38%
Arbitration
39
23% / 64%
Overdue
93
15%
Free
2
Developer 2
Rating
(1)
Projects
2
0%
Arbitration
1
0% / 100%
Overdue
1
50%
Free
3
Developer 3
Rating
(62)
Projects
140
46%
Arbitration
19
42% / 16%
Overdue
32
23%
Free
4
Developer 4
Rating
(71)
Projects
254
53%
Arbitration
16
50% / 38%
Overdue
83
33%
Free
5
Developer 5
Rating
(3)
Projects
5
20%
Arbitration
1
100% / 0%
Overdue
3
60%
Free
6
Developer 6
Rating
(548)
Projects
825
73%
Arbitration
15
53% / 13%
Overdue
193
23%
Working
7
Developer 7
Rating
(272)
Projects
394
63%
Arbitration
70
53% / 26%
Overdue
198
50%
Free
8
Developer 8
Rating
(795)
Projects
1365
72%
Arbitration
112
29% / 48%
Overdue
341
25%
Working
9
Developer 9
Rating
(9)
Projects
18
22%
Arbitration
3
67% / 33%
Overdue
4
22%
Free
Similar orders
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

Project information

Budget