MQL4 Learning - page 11

 

tight trailing stops dont work with me

dont work on interbank...i have tried all configurations

there is any other which works?????????

 

Copying Objectlist

Hi there,

Beside using a template, is there a way that I can transfer object texts from one chart onto another?

This is what I have in mind. I have notes i.e. texts on the 4 hours chart and I would use an indicator called "save text". This indicator will save all the text using ObjectGetShiftbyValue and ObjectGet(...., objprop_time). I would then open up a new 1hr chart and attach an indicator called "transfer text". This will populate the new 1hr chart with texts from the 4hrs chart in the approximate location of time and price of the 4hrs chart.

Maybe I am making this more complicate than it should be. Any pointers???

Trong

 

Proper use of Hedge order

For the guys using Hedge opening EA's for when the price goes against you, have you found it to be helpful? Just because if the price goes back into your favor before SL is hit then the Hedge order makes you loose your profit on the original order. or are there guidelines I should follow when opening a Hedge order? Like, open Hedge order when pips against me 30% of Original trade TP and set Hedge TP +110% SL -110% of original order? What are intelligent opposite % values you could use to create a Hedge order so as to cover minimal loss?

Thanks

 

can someone change this macd

hey can one of you guys change this macd so it signals a change in color on the chart that is open? i would appreciate it

Files:
 

MT4 One order cancel the other ?

Is there is a way to place two future order in MT4 one cancel the other ?

it would really be good ?

1- if it was buy sell order

2- if it was two buy orders or two sell order which ever executed first will cancel the other one.

anyone have an idea bout it pls let me know.

 

Need help, I am trying to combine 2 indicators into 1?

First of all, thanks for any help received.

I am trying to combine a CCI histogram and ADX into one indicator.

Not as in overlaying, but the code in one file.

Similar to Woodies CCI, Except using the ADX instead of the LSMA.

I have started from scratch instead of trying to modify Woodies.

I have both of them displaying. The CCI is fine.

The ADX I am showing in a lineal fashion using DRAW_ARROW.

I have 2 problems:

A. I am getting no past history on the ADX. It just starts at the current bar, if I switch time frames it starts over. I would like it to show the previuos 200 bars.

B. I want the lineal ADX to align with the Level 0 of the CCI. It currently shows above or below depending on time frame.

Thanks again.

 

Help !

I am currently using FXCM and for the past couple of weeks been trying out Metatrader.

I have a problem, a simple one.

In my FXCM platform, when I set up the MACD... I get Linear MACD, MACDA and Histogram MACD.

However, in the Metatrader, I only got a Histogram and just a line.

Anybody can help me out with this problem ?

Sorry about my english.

 

Something is wrong?

I'm trying to create an alert everytime the bar makes a new high/low compared to the previous bar. But in someway, it seems to miss some highs/lows. I can't find anything wrong with my code, but at the same time I can't figure out why?

Anyone?

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

bool AlertOnce(int ref)

{

static int NewHigh = 0;

static int FailedHigh = 0;

switch(ref)

{

case 1:

if(NewHigh == 0 || NewHigh < Bars)

{

NewHigh = Bars;

return(true);

}

break;

case 2:

if(FailedHigh == 0 || FailedHigh < Bars)

{

FailedHigh = Bars;

return(true);

}

break;

}

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int counted_bars=IndicatorCounted();

//----

if(High[0]>High[1] && AlertOnce(1)==true) Alert("1 working");

if(Low[0]<Low[1] && AlertOnce(2)==true) Alert("2 working");

//----

return(0);

}

//+------------------------------------------------------------------+
 

Check if Order is closed (and some .csv-stuff)

I'm trying to write a snippet that checks if a new trade just closed, and if that's true it will export some values to an csv.

My code looks like this:

datetime current=0;

total = OrdersTotal();

if(total > 0) current = CurTime();

if(current != CurTime()) {

int f = FileOpen(Symbol()+ATRthreshold+".csv", FILE_CSV | FILE_WRITE | FILE_READ,',');

string sDate = TimeToStr(iTime(NULL,0,0),TIME_DATE);

sDate = StringSetChar(sDate,4,'/');

sDate = StringSetChar(sDate,7,'/');

FileSeek(f, 0, SEEK_END);

FileWrite(f,sDate, TimeToStr(iTime(NULL,0,0),TIME_MINUTES), iClose(NULL,0,0), iVolume(NULL,0,0));

FileClose(f);

}

I tried some different sulotions, both found here on the forum and at Meataqoutes homepage, but i can't get anyone to work properly. My own idea is the set a variabel with the date if a position is open (orderstotal > 0 ) and compare that to the current time ( if a position isn't open, the variabel will have an old value an thereby is not equal to CurrentTime() ).

Instead, i get the ea to write to the file every volume-change when an position is open.

What have i missed out?

And, another question - is it possible to change "," in a csv export to ";"?

 

EA that opens lot and time specified

I am looking for an EA that we can set lot and time ( based on server time).

If anyone knows where to find it, kindly drop the link here. appreciate so much.

Reason: