Forum

search for the value of an indicator in the first candle back by indefinite candles

Good morning, I use an icustom function to look up the value of a buy or sell indicator in the previous candle: ex: double xyz (int index, int shift) { return (iCustom (Symbol (), PERIOD_H1, "indicator", index, shift)); } then in the ontick function I specify the following: if ( xyz (1,1) <= - 5&&

Calculate next position considering the first one

Hi, Suppose I open a buy trade at 1.23000 on eurusd with an expected TP of 10pips The market goes against me and I'd like open a new trade, this time short, at 1.20000 with a TP of 10pips. How can I calculate the lot size if I'd like to close all the trade in profit if the second one reaches the To

Show Ea result in Subwindow 1

Hi, I'n my EA I show on the left of the chart the result of some calculation Here is the code. void DrawInfo() { color foo1 = ColorText; // lets assume that: int CHFuchiu = 1 *CHFbell, CADuchiu = 1 *CADbell, AUDuchiu = 1

Find only a result in order select

Good evening, I'm trying to modify this function of my EA. The EA open several trade. What i'd like to obtain is that the function find only one thade that have the condition (in this case that the profit is >0 && <-1) Actually it retursn all the trade with this condition. Here my code double

Sum iADX of 2 days mql 4

Good evening, I'm coding an EA on mql4. I need to sum 2 iADX. Could you tell me if is this code correct? ( iADX ( NULL , PERIOD_D1 , 14 , PRICE_CLOSE ,MODE_MAIN, 1 )+ iADX ( NULL , PERIOD_D1 , 14 , PRICE_CLOSE ,MODE_MAIN, 2 )) Thanks a lot

Open sell ord buy trade some points after the last open price

Hi, I have this code of my EA to retrive info about last order: double LastOrder( string info, int type=- 1 ) { for ( int i=OrdersHistoryTotal()- 1 ;i>= 0 ;i--) { bool select= OrderSelect (i,SELECT_BY_POS,MODE_HISTORY); string sy=OrderSymbol(), mm=OrderComment(); int

Trailing stop in money instead of pips

Hi, I use a code to insert Trailing Stop on my EA: input double TrailingStop = 8 ; input double TrailingStep = 2 ; void MoveTrailingStop() { bool s,mod; for ( int cnt= 0 ;cnt< OrdersTotal ();cnt++) { s= OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES); string sy=OrderSymbol(); int

Closing a trader at close of the corrente bar

Good morning, I'm coding an Ea to open trades on 1day or 4h chart. I'd like it close the trades when the daily or 4h candle close. There's someone that can help me with the code? Thanks a lot

Mql4 code to add to my exsiting EA to close all orders depending on profit

Good moring, I'm trying to trasform my EA in a Grid system. My EA opens sell and buy orders but I'd like to ass some code to do this: -EX: I had some orders opened on EURUSD sell and buy. I'd like the EA close all orders when a certain level of profit is reached (suppose 1€ of profit) Can someone

Help with EA code

Godd evining, I'm newbie in programming EA. I'd like to to an EA that does that - If price is under lower BB and volumes is higher than a certain parameter it must buy; - If price is upper Higher BB and volumes is higher than a certain parameter it must sell; I programmed also a auto closed