How to code? - page 194

 

EA Modification

Hello,

if there is some experienced programmer who can modify my EA,

I would be very happy.

OPEN ORDER CONDITION IS NOW:

BUY:

T_S -> Blue

%WPR > -20

DeMarker > Fast MA

Fast MA > Slow MA

SELL:

T_S -> Red

%WPR < -80

DeMarker < Fast MA

Fast MA < Slow MA

Since this is sending too many false signals,

I WANT TO CHANGE IT:

OPEN BUY ORDER WHEN

1- Fast MA < 0.5 (adjustable, for example: 0.45, 0.52 etc.)

and DemarkLine crosses upwards.

2- Conditional confirmation(make it choosable):

open order when %WPR > -20,

but open order condition and confirmation

may not be further away than a certain amount of bars.

(make the number adjustable)

if the condition happens more than once,

there should be as many order openings as

there are conditions- until exit conditon

or Sell Condition occurs.

primary EXIT buy order1:

when demarkline crosses downwards Fast MA

in buy area >0.65 (number adjustable)

and CONDITIONAL:

This option is only possible with

fixed maximum of %WPR of -10 and minimum of -90 !!

Exit when crosses downwards demarkline

in area > 0.7 (adjustable)

for example: demarkline is 0.75 and %WPR is -15

Trailing stop option

automatic stopLoss should be made optional(from IndicatorT_S)

Files:
 

Can anyone program this simple OB/OS indi?

Here is the formula: (high-open) + (close-low) / (2 x Range)

Levels: 64 and 37

Thanks

 

Please , help me to modify this EA

Hello.

Please help me to modify this simple EA.

This is Hedge EA that open Buy GBP/USD and Sell EUR/USD the same time.

When positions have profit , then EA close both.

The problem is when Positions have big DD , EA not open another 2 positions , and wait too much for positions go to profit.

I need when positions have DD 20 pips , then EA open new 2 positions like first 2 positions.And when new 2 positions have some profit , then EA close only last 2 positions , and still wait for another positions that in lost.

For example:

EA open Buy GBP/USD and Sell EUR/USD.

If this 2 positions have DrowDown 20 pips , then EA open New 2 positions Buy GBP/USD and Sell EUR/USD.

If second 2 Positions have again 20 pips DD , then EA open again New 2 positions ........etc......

If Last 2 open positions have profit 20 pips , then EA have to close this 2 last positions.

In Two words - EA have to open multiple positions Buy GBP/USD and Sell EUR/USD if last 2 positions have DD 20 pips , and close last 2 positions that have 20 pips profit.

Thanks for help.

Files:
 

Five digits broker, 130 error, helppppppp!!!!

Hi everybody:

Some days ago ODL (where i have my demo account) changed to five digits prices, with this all my ordersend began to send me an alert with 130 error message(invalid stops or unnormalized), before this change i never had a problem. Searching, i found a code 'patch' when broker change to five digits price:

double dXPoint=1;

if(Digits==3 || Digits==5){

dXPoint=10;

}

[/CODE]

With this little change, my buy function now is (later dXPoint will be global, also i tried leaving it as global, without success)

[CODE]

int openBuy() {

double dXPoint=1;

if(Digits==3 || Digits==5){

dXPoint=10;

}

double price=NormalizeDouble(Ask,Digits);

double sl=price-(stopLoss*dXPoint*Point);

double tp=price+(takeProfit*dXPoint*Point);

//Alert("PRICE: ",DoubleToStr(price,Digits)," sl: ",DoubleToStr(sl,Digits)," tp: ",DoubleToStr(tp,Digits));

orderActual = OrderSend(Symbol(), OP_BUY, LotSize(), price, Slippage*dXPoint,sl, tp, "BUY", g_magic_128, 0, Green);

if (orderActual < 1){

Alert("Order " , OrderTicket() , " Error:" , GetLastError() );

return (0);

}

return (1);

}

When stopLoss and takeProfit are '0', orders are opened, but when are greatter than zero i got the 130 error, (i reviewed stoploss and takeprofit values to dont be near of price so that is not where mistake is), i also tried normalizing variables 'sl' and 'tp' without success, when i see prices in commented alert line prices values are correct, so i dont know what happen with my code, PLEASE HELP!!

THANKS A LOT GUYS!!!

 

NoLag V7.1 Whats the indicator values for an EA?

I can't for the life of me figure out how the value's translate to the EA.

I've successfully turned it into a straight line using these settings from Igors? post:

iCustom(NULL,0,"nonlagma_3",0,15,0,0,10,0,0.0)

I would like to displace and shift the MA though... I want to keep the curves

I've try changing the initial value's in the code but it doesn't seem to work.

I'm going for:

//---- input parameters

extern int Price = 3; //Apply to Price(0-Close;1-Open;2-High;3-Low;4-Median price;5-Typical price;6-Weighted Close)

extern int Length = 45; //Period of NonLagMA

extern int Displace = 0; //DispLace or Shift

extern double PctFilter = 0; //Dynamic filter in decimal

extern int Color = 1; //Switch of Color mode (1-color)

extern int ColorBarBack = 1; //Bar back for color mode

extern double Deviation = -3; //Up/down deviation

extern int AlertMode = 0; //Sound Alert switch (0-off,1-on)

extern int WarningMode = 0; //Sound Warning switch(0-off,1-on)

Any help would be appreciated.

Thank You

 

In the EA you should use following code:

- for trend or direction(up = 1, down=-1)

trend=iCustom(Symbol(),TimeFrame,"NonLagMA_v7.1",Price,Length,Dispalce,PctFilter,Color,ColorBarBack,Deviation,0,0,3,bar);

[/CODE]

- for curve

[CODE]

line=iCustom(Symbol(),TimeFrame,"NonLagMA_v7.1",Price,Length,Dispalce,PctFilter,Color,ColorBarBack,Deviation,0,0,0,bar);

If you wish to plot NonLagMA with some deviation then you should use some small values for that(ex. 0.5 or -0.5).

grstaka:
I can't for the life of me figure out how the value's translate to the EA.

I've successfully turned it into a straight line using these settings from Igors? post:

iCustom(NULL,0,"nonlagma_3",0,15,0,0,10,0,0.0)

I would like to displace and shift the MA though... I want to keep the curves

I've try changing the initial value's in the code but it doesn't seem to work.

I'm going for:

//---- input parameters

extern int Price = 3; //Apply to Price(0-Close;1-Open;2-High;3-Low;4-Median price;5-Typical price;6-Weighted Close)

extern int Length = 45; //Period of NonLagMA

extern int Displace = 0; //DispLace or Shift

extern double PctFilter = 0; //Dynamic filter in decimal

extern int Color = 1; //Switch of Color mode (1-color)

extern int ColorBarBack = 1; //Bar back for color mode

extern double Deviation = -3; //Up/down deviation

extern int AlertMode = 0; //Sound Alert switch (0-off,1-on)

extern int WarningMode = 0; //Sound Warning switch(0-off,1-on)

Any help would be appreciated.

Thank You
 

Thank You!

igorad:
In the EA you should use following code:

- for trend or direction(up = 1, down=-1)

trend=iCustom(Symbol(),TimeFrame,"NonLagMA_v7.1",Price,Length,Dispalce,PctFilter,Color,ColorBarBack,Deviation,0,0,3,bar);

[/CODE]

- for curve

[CODE]

line=iCustom(Symbol(),TimeFrame,"NonLagMA_v7.1",Price,Length,Dispalce,PctFilter,Color,ColorBarBack,Deviation,0,0,0,bar);

If you wish to plot NonLagMA with some deviation then you should use some small values for that(ex. 0.5 or -0.5).

Thank You!!!!

Whats the bar mean? Is that +1 -1 Bar?

 

Since I'm at it...

... do you know why my indicators constantly reload every 1-5 minutes on sim?

 

Help with change to five digits

Hi everybody:

I really would appreciate your help with this issue, broker where i have my demo account changed to five digits prices, with this all my ordersend began to send me an alert with 130 error message(invalid stops or unnormalized). Searching, i found a code 'patch' when broker change to five digits price. With this change, my buy function now is:

int openBuy() {

double dXPoint=1;

if(Digits==3 || Digits==5){

dXPoint=10;

}

double price=NormalizeDouble(Ask,Digits);

double sl=price-(stopLoss*dXPoint*Point);

double tp=price+(takeProfit*dXPoint*Point);

//Alert("PRICE: ",DoubleToStr(price,Digits)," sl: ",DoubleToStr(sl,Digits)," tp: ",DoubleToStr(tp,Digits));

orderActual = OrderSend(Symbol(), OP_BUY, LotSize(), price, Slippage*dXPoint,sl, tp, "BUY", g_magic_128, 0, Green);

if (orderActual < 1){

Alert("Order " , OrderTicket() , " Error:" , GetLastError() );

return (0);

}

return (1);

}

When stopLoss and takeProfit are '0', orders are opened, but when are greatter than zero i got the 130 error, i reviewed stoploss and takeprofit values to dont be near of price so that is not where mistake is, i also tried normalizing variables 'sl' and 'tp' without success, when i see prices in commented alert line prices values are correct, so i dont know what happen with my code, PLEASE HELP!!

THANKS A LOT GUYS!!!

 

Help Required

I am hoping someone can help, I have programmed the RSI values of the 4 major pairs to appear in the main chart window, when the RSI value is 85 or over the RSI value turns RED, when it is under 15 it turns GREEN, when in the middle it is BLUE.

What is happening is the program does everything expect when the figure is under 15 it stays BLUE, not sure what I have done wrong, I am hoping someone could shed some light for me.

Here is the code I have 4 the colors

color color_1 = 0, color_2 = 0, color_3 = 0, color_4 = 0;

if(sym_1 < 15) color_1 = Green;else color_1= Blue;

if(sym_1 >85) color_1 = Red; else color_1 = Blue;

if(sym_2 < 15)color_2= Green;else color_2 = Blue;

if(sym_2 >85) color_2 = Red; else color_2 = Blue;

if(sym_3 < 15)color_3= Green;else color_3 = Blue;

if(sym_3 >85) color_3 = Red; else color_3 = Blue;

if(sym_4 < 15)color_4= Green;else color_4 = Blue;

if(sym_4 >85) color_4 = Red; else color_4 = Blue;

Reason: