How to code? - page 36

 

I already readh this.

It doesn't make any sense!

Please, someone help! I m' getting really frusturated!! I still don't get it!!!

What is :

IndicatorCounted();

Bars

?????????????

 
Dan7974:
I already readh this.

It doesn't make any sense!

Please, someone help! I m' getting really frusturated!! I still don't get it!!!

What is :

IndicatorCounted();

Bars

?????????????

Rather than try and explain what is is, it's probably easier to explain the reason for its use - it makes it easy to calculate for all the available bars (Bars - 1) just once, and from then on, just for the 'current' bar.

This makes your indicator much more efficient - by not having to calculate all avaialble bars every tick, just the current bar.

 

Need Profit Display Coding Help!!!!!

//---- Pips Profit///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int j,total=OrdersTotal();

for(j=0;j<total;j++)

OrderSelect(j, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) //Reference same as Magic Number

{

pips_profit = OrderProfit() ;

}

if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference) //Reference same as Magic Number

{

pips_profit = OrderProfit() ;

}

ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);

ObjectSetText("pips_profit",pips_profit,14, "Verdana", White);//color_of_pipsprofit);

ObjectSet("pips_profit", OBJPROP_CORNER, 3);

ObjectSet("pips_profit", OBJPROP_XDISTANCE, 34);

ObjectSet("pips_profit", OBJPROP_YDISTANCE, 18);

I am trying to capture the profit from a buy or sell of 1 currency and display it on its respective currency graph. I am running 3 currencies and I would like to show on the graph of each currency its pip performance. Can you help me out??

Dave <<<
 
omelette:
Rather than try and explain what is is, it's probably easier to explain the reason for its use - it makes it easy to calculate for all the available bars (Bars - 1) just once, and from then on, just for the 'current' bar. This makes your indicator much more efficient - by not having to calculate all avaialble bars every tick, just the current bar.

Omelette,

You have a point there.

But, i'm not the kind of person who is going to do something and doesn't understand it. I just have to understand it.

Okay, here goes:

Am I right?

i.e.,

Bars=23000

IndicatorCounted()=(Bars-1) which is 22999, right?

So, i.e., (Rain=Bars-IndicatorCounted()=1),right?

And....i.e., my code says...

double rHigh;

rHigh=High[?]

?=Rain,right???

So, if I put 0 in ?, then it will calculate the High of the current bar, right?

But Rain=1 remember??? So, it will calculate data for previous bar???

Also,

what does this line mean???

if(counted_bars>0) counted_bars--;

Thank You all!!!

 

Need HELP!!

Could someone please help me with the code for the EA i have attached?

I have tried and tried to edit the code to change this without any success. Basically I want to have the EA open only one order at a time in the same direction, but I also would like it to be able to open another order in the opposite direction, basically hedging the other order if it starts to go against me, while leaving the 1st order open.

So, for example, say the EA opens a buy order, and the trend reverses after a set number of pips, I want the EA to open a sell trade to hedge the buy trade that is open.

If you wouldn't mind, could you please look at the pertinent code in the EA and let me know what I need to add or change so that the EA would execute a new trade in the opposite direction of the already open trade?

Thanks in advance for your time and help.

 

Opening two simultaneous orders

Hi all,

I'm new to MQL and I am trying to write a program that will open an order on two different pairs at one time. For example, when GBP/USD ask hits 2.0500, open a short on both GBP/USD and EUR/USD. I can only get the position to open correctly on the pair that has the EA attached to it. On the other pair I receive Error 129 (outdated prices). I have tried to use RefreshRates() and it doesn't seem to help, but I could be doing it wrong (I've read the documentation, but didn't get much from it). Can anyone point me to some information that can help me out or post some basic code to get this to work?

I posted this question over at MQL4.com and haven't gotten a response yet so I thought I would try the good group here. I'm sure there's something posted already on this but I just can't find it.

Thanks!

 

System that is not indicators dependant

The system is called the 1 Hour bar reversal and breakout.

This system is simple and follow simple rule of price action, the rule is that after a 90 pips movement in a 1 hour bar , there will be a move of 20 pips in both directions.

I didnt build my analysis on assumptions nether on a test that expands for a week but rather applied the logic on excel sheet for the whole history of GBPJPY.

The analyses include results of profit and loss percentage.

I will be glad to share the results with an expert who can code and verify the data.

The code for this expert can be few lines since the idea is very very simple.

If results are acceptable and profitable over a range of forward testing (3 months) period, then we can (all those involved in the development) introduce this expert on the commercial section.

 

I'm sure I can help - can you expand a bit?

 

*Multiple Lots Pending Script*

Hello

I need some help on creating a Script that can open Multiple Pending lots (5 lots Total all at once)

A Pending BuyStop & BuyLimit, SellStop & SellLimit Scripts

Some must haves:

-Ability to change settings when script is intitiated (GUI)

Have these settings in the GUI.

-EntryPrice

1st Lot: 20 TP , with "x" lots

2nd Lot: 30 TP , with "x" lots

3rd Lot: 40 TP , with "x" lots

4th Lot: 50 TP , with "x" lots

5th Lot: 60 TP , with "x" lots

-Stoploss

-TradeComment

-Expiration time e.g 20:00pm

--Ive tried to make one myself but no luck can only open one lot..lol

Thank for the help

 

2 Steps Back With This Indicator

USING THIS INDICATOR IN AN EA:

DAYHIGH=iCustom(NULL,0,"dayHL",0,0);[/PHP]

THIS WOULD OBTAIN THE CURRENT HIGH.

HOW DO I FIND THE CURRENT HIGH 2 STEPS BACK SINCE THIS INDICATOR STEPS UP OR DOWN ON DAILY HIGHS??

[PHP]DAYHIGH=iCustom(NULL,0,"dayHL",0,2)

DOES NOT WORK BECAUSE OF STEPPING IN THE INDICATOR. WHAT CODING SHOULD I USE??

INDICATOR IS ATTACHED - IF YOU HAVE THE RIGHT ANSWER, PLEASE TELL ME THE CODING. MUCH THANKS IN ADVANCE!!

Dave

Files:
dayhl.mq4  4 kb
Reason: