Download MetaTrader 5

Requests & Ideas (MQL5 only!) - page 30

Vladimir Karputov
Moderator
85784
Vladimir Karputov  
ItaTrader_93 :

Yeah, actually my comment was unnecessary.


Although ... Maybe you're right. Look at the differences:

Percentage OHLC vs Size of a candle (histogram)

Files:
ItaTrader_93
19
ItaTrader_93  
Vladimir Karputov:

Although ... Maybe you're right. Look at the differences:



Thank you Vladimir, slightly different from my idea but still very helpful.


:)

Yong Zhang
408
Yong Zhang  

1.    Open a position (BUY / SELL) according to the signal (such as Stochastic), set the stop loss to a fixed size, and calculate the lot size according to the free margin.

2.    If the last position is profitable, and the current price has been a distance from the last price(Last open price ± price steps), Then add a position; The size of the lot for each position increase is the last lot minus a fixed value (the last lot size - a fixed value), if the size of lot has been reduced to the minimum allowed for the transaction, the size of the lot Equal to the minimum allowable value; If continue to profit then continue to increase positions;

3.    When the total number of positions is greater than the set value (for example, 5) or the total profit value is greater than the set value (for example 100 points), start trailing profit taking;

4.    If the total number of positions is > 1, the price callback makes the profit less than or equal to 0 (breakeven position), close all positions;

5.    If Trailing Take Profit is triggered, all positions are closed or the total profit reaches the set value(for example 200 points), all positions are closed.

Vladimir Karputov
Moderator
85784
Vladimir Karputov  
Yong Zhang :

1.    Open a position (BUY / SELL) according to the signal (such as Stochastic), set the stop loss to a fixed size, and calculate the lot size according to the free margin.

2.    If the last position is profitable, and the current price has been a distance from the last price(Last open price ± price steps), Then add a position; The size of the lot for each position increase is the last lot minus a fixed value (the last lot size - a fixed value), if the size of lot has been reduced to the minimum allowed for the transaction, the size of the lot Equal to the minimum allowable value; If continue to profit then continue to increase positions;

3.    When the total number of positions is greater than the set value (for example, 5) or the total profit value is greater than the set value (for example 100 points), start trailing profit taking;

4.    If the total number of positions is > 1, the price callback makes the profit less than or equal to 0 (breakeven position), close all positions;

5.    If Trailing Take Profit is triggered, all positions are closed or the total profit reaches the set value(for example 200 points), all positions are closed.


I like this idea more:

1. Entering the market for purchase if the indicator RSI is above 50% on the hourly timeframe and the condition with the size of the stop-loss is fulfilled, see p. 3.

2. Entries are made once a day. On the day there may be one purchase transaction, as well as one transaction for sale.

3. If the size of the stop-loss is greater than SLmax, then ignore the signal to the input. Stop loss is equal to the price of the minimum of the previous day bar - 10 points.

4. Take profit is three times the size of the stop-loss.

5. Transfer to breakeven if the price has passed the distance in the positive direction is not less than the size of the stop-loss.

6. If there is an open position and the next day received a signal for the input, then we process the following signals.

7. On sales, all conditions are back-mirrored.


I will implement this idea in MQL5 code.

Vladimir Karputov
Moderator
85784
Vladimir Karputov  
Vladimir Karputov :

I like this idea more :

1. Entering the market for purchase if the indicator RSI is above 50% on the hourly timeframe and the condition with the size of the stop-loss is fulfilled, see p. 3.

2. Entries are made once a day. On the day there may be one purchase transaction, as well as one transaction for sale.

3. If the size of the stop-loss is greater than SLmax, then ignore the signal to the input. Stop loss is equal to the price of the minimum of the previous day bar - 10 points.

4. Take profit is three times the size of the stop-loss.

5. Transfer to breakeven if the price has passed the distance in the positive direction is not less than the size of the stop-loss.

6. If there is an open position and the next day received a signal for the input, then we process the following signals.

7. On sales, all conditions are back-mirrored.


I will implement this idea in MQL5 code.


First tests (EURUSD):

RSI Eraser EURUSD

I add the results of optimization "Balance + min Drawdown". Initial deposit $ 100. Optimization period: from January 6 2017 to November 15 2017, timeframe "H1". Files need to change the extension from "txt" to "xml" ...

elciomartins
7
elciomartins  

Hi guys! I am newbie...! When i run that script a message appear to me. Hedging only the ea will be unloaded. can u guys give a little help? And Vladimir... you rock man... awesome script!

Vladimir Karputov
Moderator
85784
Vladimir Karputov  
elciomartins :

Hi guys! I am newbie...! When i run that script a message appear to me. Hedging only the ea will be unloaded. can u guys give a little help? And Vladimir... you rock man... awesome script!


What kind of script is it? Please use the "reply" button:

"reply" button

bersemi asror
117
bersemi asror  

Hello Vladimir, i hope you good today, 

I want strategy Multi Pending Order "SELLLIMIT and BUYLIMIT. After SELLIMIT open, deleteAll Buylimit, 



Input : 

(for Buy/Sell Limit) 

------------------------ 

MaxOP1 =.. 

InpDistance =-... 

InpStep = .. 

Target Profit (in Money) =... 



(for(Buy/Sell Stop) 

---------------------- 

Max OP2=.... 

InpDistance2 : ... 

InpStep2 : ... 

Take Profit : ... 

Stop Loss : ... 





Term / Illustration : 

- if Open SellLimit, delete All Buylimit. 

- After All Sellimit Open, open BuyStop with Take Profit and SL 



just that my idea of strategy 



Thank You 



Regard, 

Asror

Felipe Ponce Aragon
971
Felipe Ponce Aragon  

Dear Vladimir,


I just can't believe this marvellous thread!!! I didn't want to share my idea in public but since you created this amazing thread here it is. 

Hedging EA.

1. It needs: GMT difference parameter (If your broker is GMT+3 you enter 3. If your broker is GMT you enter 0).

2. Forbidden time start parameter. The EA will only open and close new trades on new bar. but you will Skip the new bar during the time starting on this parameter. BUT TRADES CAN BE CLOSED DURING THIS PERIOD, JUST NOT OPEN.

3. Forbidden time end parameter. The EA will only open new traes after this time.

4. Fix lot parameter. The EA will open the first trade and hedging trades with this lot. No Martingale, all trades with same lot.

5. When to open the first trade: The entry is not important because the importance here is in the hedging mechanism. So first trade will be too simple: BUY if 200 EMA is below the new bar open. SELL if 200 EMA is above the new bar open. We only open trade if we are not in the forbidden time.

6. After opening the trade, close with any profit in dollars that is above $0, on the next new bar open. Must consider swaps in this profit (if there is -$1 loss due to swap, the EA will close the trade if it has made at least $1.01 profit. $1.01-$1 = $0.01).

7. If at open of next new bar the trade is not in profit, remain open until we close all trades together in overall profit.

8. If we have an open trade that is not in profit, we will open a new trade at the open of every new bar during the next bars or until we have overall profit, whatever happens before, EXCEPT THAT WE WILL SKIP BARS during the time specified in start and end parameter. During that time we don't open trades. This is not grid trading. We will just open the trades until we have a profit at any new bar, and then close it. If distance between bar opens is only the spread (0 pips + spread) we will still open the trades.

9. If we have 8 open trades or more we will open new trades in the exact same way as the first 8 trades, but now we will open them only if there's a distance of at least 10 pips (100 points) of drawdown between this new bar and the closest previous trade. This is not grid trading, we will open trades at whatever distance the new bar opens, as long as it's minimum 10 pips with respect to any previous trade AND that we're not in the forbidden time.

10. IF the distance of current bar open is 500 to 999 pips from price of the first trade we opened, we will now open in the same way as in #9, but now we will SKIP 3 candles between trades, plus the minimum 10 pips distance, plus we don't open in the forbidden time. 

11. IF the distance of current bar open is 1000 to 2000 pips from price of the first trade we opened, we will now open in the same way as in #9, but now we will SKIP 6 candles between trades, plus the minimum 10 pips distance, plus we don't open in the forbidden time. 


We will continue with step #11 until the infinite, opening new trades until we close all trades on new bar in overall profit.


when we close a trade in profit in new bar and we have a signal at this moment, we will open a new trade at the same time. Also, if we closed more than 1 trade and we have a valid signal, we also open a new trade.


In case of doubt contact me :) Or reply here.

Vladimir Karputov
Moderator
85784
Vladimir Karputov  
bersemi asror:

Hello Vladimir, i hope you good today, 

I want strategy Multi Pending Order "SELLLIMIT and BUYLIMIT. After SELLIMIT open, deleteAll Buylimit, 



Input : 

(for Buy/Sell Limit) 

------------------------ 

MaxOP1 =.. 

InpDistance =-... 

InpStep = .. 

Target Profit (in Money) =... 



(for(Buy/Sell Stop) 

---------------------- 

Max OP2=.... 

InpDistance2 : ... 

InpStep2 : ... 

Take Profit : ... 

Stop Loss : ... 





Term / Illustration : 

- if Open SellLimit, delete All Buylimit. 

- After All Sellimit Open, open BuyStop with Take Profit and SL 



just that my idea of strategy 



Thank You 



Regard, 

Asror


And you yourself traded on this strategy? There are results?