Weekend evening - page 4

 
Алексей Тарабанов:

Do you take drugs?

Heh, no, I don't drink or smoke, and it's irrelevant. If you don't like the style, just walk away. But then I would rob cars and lie on the couch, rather than digging in code and writing on forums. And you, judging by your posts, just want to write something.

 
Okay. Let's go back to the Expert Advisor.
  if(InpTrailingStop!=0 && InpTrailingStep==0)
     {
      Alert(__FUNCTION__," ERROR: Trailing is not possible: the parameter \"Trailing Step\" is zero!");
      return(INIT_PARAMETERS_INCORRECT);
     }
where is position modification here? or did you miss it?
in a neighboring thread you wrote an example for netting
//---
   double Ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),Digits());
   if(!PositionSelect(Symbol()))
      trade.Buy(0.01,Symbol(),Ask,Ask-stop*Point(),Ask+take*Point(),NULL);

   TrailingStop(Ask);
  }
//+------------------------------------------------------------------+
void TrailingStop(double Ask)
  {
   if(m_position.SelectByIndex(i))
     {
      ulong PositionTicket=PositionGetInteger(POSITION_TICKET);
      double CurrentStopLoss=PositionGetDouble(POSITION_SL);


      if(MathAbs(CurrentStopLoss-Ask)>stop*Point())
         trade.PositionModify(PositionTicket,(Ask-stop*Point()),0.0);
     }
  }
//+------------------------------------------------------------------+
how do i modify it correctly and add it to my EA ?
Совершение сделок - Торговые операции - MetaTrader 5
Совершение сделок - Торговые операции - MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
 
NightTrader:
Ok. Let us get back to the EA. In your code it says
where is the modification of positions?
***

This is a stopper - a preparation for the future. Just in case. Remind you that there is no position trailing in the initial condition:

Forum on trading, automated trading systems and trading strategy testing

Weekend Evening

Vladimir Karputov, 2018.04.01 15:39

To summarise:

I came up with a name like this (not to bother, just created a name in the password generator) -"OSYuWwJk EA".

Description:

Forum on trading, automated trading systems and trading strategy testing

Weekend Evening

NightTrader, 2018.03.31 22:52

Hi. I'll be the first then . 3abate MQL5 Expert Advisor.

Entry by RSI, MA filter. Benchmark on senior H1 timeframe.
Entry conditions

Relative Strength Index, MA, SL, TP, BU. Closing of all orders on the total profit and opposite signals.

Opening trades to the short, when the price is below MA 110 on H1, and RSI (4) has a value of 70 and above. We fill in the trend with the next order, when the order goes in the boo at 30 points. At closing on ТР we open a new trade, if conditions of an input have not changed. We wait for the following signal.

Opening of transactions in buy, when the price is above MA110 on H1 and RSI (4) has a value from 30 and below.

We fill in the trend with the next order, when the order leaves in Boo at 30 points. At closing on ТР we open a new trade, if entry conditions have not changed. We wait for the next signal.
That is the general case for the initial variant.

Forum on trading, automated trading systems and strategy testing

Weekend Evening

NightTrader, 2018.04.01 15:07

Visualising entry points is of course better to track and correct missteps that may arise in the process. Better when the EA reports when it opened an order and the reason for closing. I forgot to mention the trawl, because CU and TRALingStop are different things.

 

EA"OSYuWwJk EA.mq5" is finished.

In version "1.004" we have added trailing.

Let me remind you of previous versions:

Forum on trading, automated trading systems and trading strategies testing

Holiday Evening

Vladimir Karputov, 2018.04.02 16:38

OSYuWwJk EA.mq5

version "1.001"


Sets the RSI levels (UP and DOWN) to analyse the situation and obtain the signal.

Simple analysis at the moment:

  • BUY: Ask() > Moving Average on bar 1 AND RSI on bar 1 <= RSI DOWN level
  • SELL: Bid() < Moving Average on bar 1 AND RSI on bar 1 >= RSI UP level


Forum on trading, automated trading systems and trading strategies testing

Holiday Evening

Vladimir Karputov, 2018.04.03 05:42

OSYuWwJk EA.mq5

version "1.002"

Now:

RSI levels settings (UP and DOWN) to analyse the situation and get a signal.

Simple analysis at the moment:

  • BUY: Ask() > Moving Average on bar 1 AND RSI on bar 1 <= RSI DOWN level
  • SELL: Bid() < Moving Average on bar 1 AND RSI on bar 1 >= RSI UP level


Close opposite positions on a signal. New position only if the last one is at breakeven. If we have both BUY and SELL positions - this is an error situation, and it is not handled in any way.


Forum on trading, automated trading systems and trading strategies testing

Weekend evening

Vladimir Karputov, 2018.04.07 05:36

***

And today is version 1.003:

OSYuWwJk EA.mq5
version "1.003"

Added parameter "Total profit" - Total profit. When total profit is reached, all positions will be closed.


Files:
OSYuWwJk_EA.mq5  38 kb
 
Anyone interested?
 
Vladimir Karputov:
Are there any volunteers?

Yes, there are some interested parties.

In continuation of the conversation in the subject ofN-_Candles_v7: I have an idea for the following EA.

1) Opening positions, likeN_Candles, on a series of identical candles, but in the opposite direction to the trend of the candles (reversal of the price)

2) Closing of orders:

a) If the total monetary profit is reached. All orders are closed and everything is reset - the cycle starts from the beginning.

b) If the opposite direction order is opened. (e.g. only SELL and opposite BUY are opened, then one SELL order, the most profitable one and the new BUY are closed).

3) If possible, keep calculation of negative closed pairs, and increase total profit by the value of this loss. ( The specified profit should be increased by the amount of loss of the closed pair.)

4) If it is not difficult. To introduce the parameter on opening in a series of identical candlesticks restriction on buying after N number of candlesticks. For example, the parameter - buy after a series of 5 candlesticks, and there are 9 identical candlesticks in the series. And we only need to buy after 5 and 6 candlesticks, and after 7,8 and 9 candlesticks were forbidden to buy.

 
Hello Vladimir. I would like to clarify, if you don't mind answering.
The parameter in the EA settings OSYuWwJk EA 004.mq5
Breakeven
also purely as a stub for the future, i.e. it does not work in the code?
input ushort               InpBreakeven         = 15;                // Breakeven ("0" -> off)
 
NightTrader:
Hello Vladimir. I would like to clarify, if you don't mind answering.
The parameter in the EA settings OSYuWwJk EA 004.mq5 is also a dummy for the future, i.e. it does not work in the code?

Yeah, I guess I thought about it and didn't think about it :)

 
Vladimir, help for a dummy. I have several currency pairs open. The task: when a candle crossesthe upper Bollinger boundary of a bull candle or the lower boundary of a bear candle, in any pair, the computer should bleep loudly and open the whole screen of the pair where the event occurred. The simultaneous crossing of the BB by a candle in several pairs is considered as almost unbelievable. I used to write programs in C without two pluses to control the hardware.
 
where to send your T.O.S.