Coding help - page 78

 
rakibhasan2020:
Can anyone create this EA from some available hedging EA?

1. Two positions (i will input the number) will be opened......1 buy stop and 1 sell stop ( i will manually input 1.2900 and 1.2800)

2. there will be TP (in pips)

3. there will be SL (in pips)

4. there will be TSL (in pips)

5. there will be opening lot ( 0.01 to 100 lot)

6. only one position will open

5. A hedging order (one position with same lot) will open only when SL/TSL hits (with the same TP/SL/TSL of the initial entry)

6. can be used for all pairs with magic numbers.

it will be good option for sequence trading.......!

try the Martingale EA!

 

Hi!

i can't new thread open.

could you help me?

I try to do EA hedge.

Hedge for one open order.

And i don't know what's wrong with conditions.

double bid = MarketInfo(Symbol(), MODE_BID);

double ask = MarketInfo(Symbol(), MODE_ASK);

OrderSelect(1,SELECT_BY_POS,MODE_TRADES);

cena=OrderOpenPrice();

ce=cena-60*Point;

typ=OrderType();

if (OrdersTotal()==1 && typ==0 && ce>bid)

OrderSelect(1,SELECT_BY_POS,MODE_TRADES);

cena=OrderOpenPrice();

ce=cena+60*Point;

typ=OrderType();

if (OrdersTotal()==1 && typ==1 && ce<ask)

 
serafin:
Hi!

i can't new thread open.

could you help me?

I try to do EA hedge.

Hedge for one open order.

And i don't know what's wrong with conditions.

double bid = MarketInfo(Symbol(), MODE_BID);

double ask = MarketInfo(Symbol(), MODE_ASK);

OrderSelect(1,SELECT_BY_POS,MODE_TRADES);

cena=OrderOpenPrice();

ce=cena-60*Point;

typ=OrderType();

if (OrdersTotal()==1 && typ==0 && ce>bid)

OrderSelect(1,SELECT_BY_POS,MODE_TRADES);

cena=OrderOpenPrice();

ce=cena+60*Point;

typ=OrderType();

if (OrdersTotal()==1 && typ==1 && ce<ask)

Try changing :

OrderSelect(1,SELECT_BY_POS,MODE_TRADES); [/CODE]

to

[CODE]OrderSelect(0,SELECT_BY_POS,MODE_TRADES);

"1" in OrderSelect() when selecting by position means the second opened order not the first one

 

this is it:) thank you very much:)

 

Coding Help

The attached indicator has the following source statements--

hhb = Highest(NULL,0,MODE_HIGH,dist,i-dist/2);

llb = Lowest(NULL,0,MODE_LOW,dist,i-dist/2);

However, neither function is defined in the file and there are no Include statements.

This indicator compiles successfully and can be attached to a chart.

Therefore, how does MQL call these functions??

Files:
 
michaelB:
The attached indicator has the following source statements--

hhb = Highest(NULL,0,MODE_HIGH,dist,i-dist/2);

llb = Lowest(NULL,0,MODE_LOW,dist,i-dist/2);

However, neither function is defined in the file and there are no Include statements.

This indicator compiles successfully and can be attached to a chart.

Therefore, how does MQL call these functions??

michaelB

Those are obsolete names for iHighest() and iLowest(). The compiler simple replaces those function names with iHighest() and iLowest() and that is why you do not get any error

 

mladen--

regarding the super-signals_v2 indicator, Thank you for the quick response.

One more question, when I attach this indicator, it initially shows alternating red and green arrows. If I watch the chart in realtime,

there may be several consecutive arrows of the same color.Then if I switch to a different timeframe, and back again, many of the arrows disappear and the chart once again shows alternating red and green arrows.

Would it be difficult to modify this indicator so that the arrows do not disappear? Thanks again.

 
michaelB:
mladen--

regarding the super-signals_v2 indicator, Thank you for the quick response.

One more question, when I attach this indicator, it initially shows alternating red and green arrows. If I watch the chart in realtime,

there may be several consecutive arrows of the same color.Then if I switch to a different timeframe, and back again, many of the arrows disappear and the chart once again shows alternating red and green arrows.

Would it be difficult to modify this indicator so that the arrows do not disappear? Thanks again.

michaelB

Try it out now

Files:
 

How to add text label appearing on a horizontal line?

 
zigflip:
How to add text label appearing on a horizontal line?

That is a very general question

You can create a label using ObjectCreate() function (using OBJ_LABEL as an argument for type). Here is a description of oObjectCrate() function :

[/TR]

[TR]

[TD="width: 100%"]Price part of the first point.

[TR]

[TD]time2 [TD] - [TD="width: 100%"]Time part of the second point.

[TR]

[TD]price2 [TD] - [TD="width: 100%"]Price part of the second point.

[TR]

[TD]time3 [TD] - [TD="width: 100%"]Time part of the third point.

[TR]

[TD]price3 [TD] - [TD="width: 100%"]Price part of the third point.
bool ObjectCreate(

[/TD]

string name, int type, int window, datetime time1, double price1, datetime time2=0, double price2=0, datetime time3=0, double price3=0)[/TD]

[/TR]

[/TABLE]

Creation of an object with the specified name, type and initial coordinates in the specified window. Count of coordinates related to the object can be from 1 to 3 depending on the object type. If the function succeeds, the returned value will be TRUE. Otherwise, it will be FALSE. To get the detailed error information, one has to call the GetLastError() function. Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE properties.

Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index.

Coordinates must be passed in pairs: time and price. For example, the OBJ_VLINE object needs only time, but price (any value) must be passed, as well. Parameters:

[TABLE="class: docparams"]

name[/TD] - [/TD] Object unique name.[/TD]

[/TR]

type[/TD] - [/TD] Object type. It can be any of the Object type enumeration values.[/TD]

[/TR]

window[/TD] - [/TD] Index of the window where the object will be added. Window index must exceed or equal to 0 and be less than WindowsTotal().[/TD]

[/TR]

time1[/TD] - [/TD] Time part of the first point. price1 -