Ask! - page 72

 
reiver:
I hope someone can help me with something I initially thought would be quite straightforward. I wanted to put an audible alert on an indicator that actually comes with Metatrader so that when it reaches a particular level it will tell me. The indicator is Force Index however I can not find an MQ4 file for it anywhere in the Experts/Indicators folder. Does anyone have an idea where I could locate the file?

If I can find the mq4 file would I be right in assuming I can use the code given by Codersguru at the beginning of this thread to add an alert to it?

thanks

I searched my 2,000 indicators and came up blank also. Maybe you could use the Juice indicator as a substitute???

Dave

<<<

This Force Index indicator is available from the Meta tradeplateform indicators, but without coding!

 
Julia:
Okay, here's the deal. For the above code, I want the OrderSend........and the continuing part to create a BuyStop 30 pips above the price at 15:30:00, and a SellStop 25 pips underneath the price at 15:30:00.

I think the terminology is "limit orders"; stop orders are pending orders in reverse to the price movement, and limit orders are pending orders with the price movement. Thus, you'd set a BuyLimit (or SellStop) above the current price and a SellLimit (or BuyStop) below the price. Apart from that, you already have the basic elements.... or maybe someone else wants to assist with actual code.

 
iscuba11:
How can use ObjectCreate on an indicator-separate-window versus the chart-window???? This would be handy!
Dave <<<

Hi iscuba11,

All you have to do is:

ObjectCreate("Object Name",OBJ_LABEL,1,0,0);

The "1" is the first window after "0" - Main chart window. So if you have 3 indicator windows open under the main chart window and you want your object to appear on the third indicator window, you would use a "3" instead of "0".

In this light I often use a "Blank" indicator window to place object labels in and often use these object labels to test my code "Live - as it happens" to confirm that my code is indeed operating correctly and things occur when and how they should.

 

ralph.ronnquist

SellLimit - sell above the price

BuyLimit - buy below the price

If you don't trust me - try setting a SellLimit below the price and post a picture with such a trade

 

Thanks a whole bunch for the code enlightening. Another golden nugget to add to my learning.

Thanks and have a great weekend!!

Dave <<<
 

Seperate_Window Control question

One last question for the evening. How does one control the size of the indicator window??? I want the window to be only 3/8" tall.

I tried:

#property indicator_width1 90

out of desperation to see what it does, but nothing happens.

Actually it is the height (tall) of the indicator window from the bottom of the graph I am concerned with.

Any suggestions will be entertained!!!!!!!!!!!!!!!!

Dave <<<
 

Thank you people. That was very useful info.

One more thing.

Let's say that at 16:00, my pending orders were not hit, or my open positions didn't rach tp or sl. What would the code be? Something short, and understandable please.

And.

Let's say, at 16:00, you know how I want to cancel any open positions, and delete any pening orders. Now, I would like it to do this when the market recognizes the first tick atfer 16:00. Thank you.

---Julia---

 

Simply use template

iscuba11:
One last question for the evening. How does one control the size of the indicator window??? I want the window to be only 3/8" tall.

I tried:

#property indicator_width1 90

out of desperation to see what it does, but nothing happens.

Actually it is the height (tall) of the indicator window from the bottom of the graph I am concerned with.

Any suggestions will be entertained!!!!!!!!!!!!!!!!

Dave <<<

I haven't actually tried to programmically change indicator window height. I've usually just sized it manually and then saved the template. Then when recalled to any chart window the indicator window remains constant, unless resized manually again.

Maybe others have an idea on this.... I've just never given it much thought since saved template is available.

Have a good weekend yourself, iscuba11

SaxMan

 

I think I will have to do the same - Use templates.

Dave

<<<

 

gratituously....

static bool closed = false;

if ( closed && TimeHour( Time[0] ) != 16 ) {

closed = false;

}

if ( TimeHour( Time[0] ) == 16 && ! closed ) {

closed = true;

// Close/delete everything open ...

for ( int i = OrdersTotal() - 1; i >= 0; i-- ) (

if ( ! OrderSelect( i, SELECT_BY_POS ) ) {

closed = false; // Try again on next tick

continue;

}

switch ( OrderType() ) {

case OP_BUY:

OrderClose( OrderTicket(), OrderLots(), Bid, 1 );

break;

case OP_SELL:

OrderClose( OrderTicket(), OrderLots(), Ask, 1 );

break;

default: // All pending orders

OrderDelete( OrderTicket() );

}

}

}
Reason: