Create a simple Martingale

 

Hello Dear Traders! I am asking you to create a simple Expert Advisor, based on Martingale. I would like to make an EA, which would increase lot size with certain amount of times after a losing trade, and open trades with МА indications.

The candlestick closed above the MA - the first deal is Buy, below - Sell, then the logical chain!

Variables

MagicNumber- order identifier
Lot- initial lot size
TakeProfit- TakeProfit in points
StopLoss- stop loss in points
MultyLot- how many times the lot of the next trade will be doubled after the loss-making one
Logic- trade opening logic ( value - 1, 2, 3 or 4)
OneSetka- (true - only one logical grid opens in the direction of MA, false - 2 grids work)
if the price is higher than MA and the first deal (Buy) is opened in the mode true - deals are opened only in the
a logical chain starting from the first trade, and if the mode false - when the price is opened in
in one direction, after the MA is crossed in the other direction, a grid with its own logical chain is opened!
chain!

Adjustments of Moving Average

МА_Work- true or false (if true - the first trade opens on the candle's close in the direction of the MA according to the logic stated below, and if false - the orders are opened not according to logic, but simply
at the close of the candle with a further increase in the lot, if the candle is bullish - buy, if bearish - Sell and after a losing trade, the following trades are opened not considering the MA and the logic below, and
just on candle's close!
MA_period - period of Moving Average
MA_metod- method of averaging moving average
1 - Simple
2 - exponential
3 - Smoothed
4 - Linear Weighted
Shift - "0" zero

Apply to - close

Opening logic

1st Logic grid

EXAMPLE of grid
Lot - 0.1 Lot - 0.1
MultyLot - 2 MultyLot - 2
Price HIGH MA Price LOW MA

Buy - 0.1 Sell - 0.1
Sell - 0.2 Buy - 0.2
Buy - 0.4 Sell - 0.4
Sell - 0.8 Buy - 0.8
Buy - 1.6 Sell - 1.6
Sell - 3.2 Buy - 3.2
Buy - 6.4 Sell - 6.4
and so on, until take profit is hit, after take profit the first deal
Opened with the lot size specified in the settings - Lot - that is the minimum!

2nd logical grid

EXAMPLE of a grid
Lot - 0.1 Lot -0.1
MultyLot - 2 MultyLot - 2
Price HIGH MA Price LOW MA

Buy - 0.1 Sell-0.1
Buy - 0.2 Sell-0.2
Sell - 0.4 Buy -0.4
Sell - 0.8 Buy -0.8
Buy - 1.6 Sell-1.6
Buy - 3.2 Sell-3.2
Sell - 6.4 Buy -6.4
Sell - 12.8 Buy -12.8
That is two orders of the same type and so on, until take profit is hit, after take profit the first deal
opens with the lot size specified in the settings - Lot - that is the minimum!

3rd logical grid

EXAMPLE of a grid
Lot - 0.1 Lot -0.1
MultyLot - 2 MultyLot - 2
Price Above MA Price Below MA

Buy -0.1 Sell-0.1
Buy -0.2 Sell-0.2
Buy -0.4 Sell-0.4
Sell -0.8 Buy -0.8
Sell -1.6 Buy -1.6
Sell -3.2 Buy -3.2.
That is three orders of the same type and so on, until take profit is hit, after take profit the first order
Opened with the lot size specified in the settings - Lot - that is the minimum!

4th logical grid

EXAMPLE of a grid

Lot - 0.1 Lot -0.1
MultyLot - 2 MultyLot - 2
Price Above MA Price Below MA

Buy -0.1 Sell-0.1
Buy -0.2 Sell-0.2
Buy -0.4 Sell-0.4
Buy -0.8 Sell-0.8
Sell -1.6 Buy -1.6
Sell -3.2 Buy -3.2
Sell -6.4 Buy -6.4
Sell -12.8 Buy -12.8
That is four orders of one type and so on, until take profit is hit, after take profit the first deal
opens with the lot size specified in the settings - Lot - that is the minimum!

IMPORTANT!!!
Take Profit and Stop Loss should be set at the moment of opening a trade, not after the order is opened!
The advisor has to work without interfering with other advisors on one currency pair and in the terminal in general!
All deals are opened on the close of the candlestick!
If a candlestick closed below the MA, and not its tail!
It is important that in the OneSetka - false mode the Expert Advisor doubles the lot for each grid separately, and does not touch the orders of the other grid!
The Expert Advisor should work on both five- and four-digit charts, with a fixed spread and floating!

Initial parameters of the Expert Advisor


MagicNumber - 1234567
Lot - 0.01
TakeProfit - 10
StopLoss - 10
MultyLot - 2
Logic - 2
OneSetka - false
MA_period - 21
MA_metod - 3












 
For free?!
 
ktest0:
Free?!

Even the drain is paid for, leaving everything to the DC!
 
borilunad:

Even the drain is paid, leaving everything to the DC!

That's true, but the DC gets paid for his own naivety, and who would pay a working programmer?
 
ktest0:

This is true, but the DC is paid for his own naivety, and who will pay a working programmer?

It's who's going to send him, and it might as well be who's going to send him!
 

A heated discussion, that's good ) DYN - thanks for the substance!

Another question:" How much do you want for this "plum advisor"?

 
VitaliyBerkut:

A heated discussion, that's good ) DYN - thanks for the substance!

Another question:" How much do you want for this "plum advisor"?


Joba is good because there you choose the coder who offers the best price, timing and quality.
 
VitaliyBerkut:

Will make fast and quality MT4 (real/demo/tester).

More Info

Skype :valeryk10 Mail:kvl29@hotmail.com

ReviewsCompleted ordersNew order for valeryk

From $50 to 5 days
 
VitaliyBerkut:

A heated discussion, that's already good ) DYN - thank you for being to the point!

Another question: "How much do you want for this "losing EA"?

You're welcome)).

And... plum or promising one can only tell after testing. It's obvious from the get-go that it will drain on the spread. But since you're using lot play...then you need a series of trades to check for randomness.

 
DYN:

You're welcome.)

And... plum or promising you can only tell after testing. It's obvious from the get-go that it will drain the spread. But since you're using the lot game...then you need a series of trades to check for randomness.



It will go broke only if you limit it to the maximum allowable DC lot, or of course if you put it on a securities account in a hundred cents))

But if you include your brain, put a certain amount of money and put it on a cent account and do not forget to diversify........ that's what you need to test.

Reason: