Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (2) Thread Tools Display Modes
  #321 (permalink)  
Old 08-31-2006, 01:55 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 289
phoenix is on a distinguished road
Quote:
Originally Posted by iscuba11
Where does the modification take place in this?? The original stop loss was 40, and the take profit was 100. As a part of the sleep mode, the stop loss is to change to 15 on any existing open orders and the take profit is to change to 25 on any existing open orders.

Open Order Tickets:
Prior to sleep mode.

Before Sleep Mode Stop Loss - 40 Before Sleep Mode Take Profit-100 After Sleep Mode Stop Loss Modification -15 After Sleep Mode Take Profit Modification - 25

I am not initializing order settings, I am modify existing orders already placed and still active.

Thanks for you help anyhow! Why does something so simple seem so difficult?

Dave
<><<

how do you define your sleep mode?
just add it before the ordermodify() loop
like..
PHP Code:
if(sleepcome)
{
   for(.....)
   {
    
//delete my code gave you before or make it as comment
    
orderselect(.....);
    .
    .
    .
   }

may this help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #322 (permalink)  
Old 08-31-2006, 02:03 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 289
phoenix is on a distinguished road
Quote:
Originally Posted by AnasFX
Hi guys

I am programming an EA that uses a trailing-stop. The thing is that when it hits a stop-loss then it opens a new order. So, the question is that how to tell the EA that when an order hits a stop-loss then wait for the next bar to decide if you want to open a new order?? anyhelp please?
check the trade history if the ordercloseprice() = orderstoploss() then it close by hit the sl
PHP Code:
   for(int hcnt=0;hcnt<HistoryTotal();hcnt++)
   {
      
OrderSelect(hcntSELECT_BY_POSMODE_HISTORY);
      if(
OrderSymbol()==Symbol())
      {
         if(
OrderClosePrice()==OrderStopLoss())
         .
         .
         .
      }
   } 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #323 (permalink)  
Old 08-31-2006, 04:18 PM
AnasFX's Avatar
Junior Member
 
Join Date: Jul 2006
Posts: 5
AnasFX is on a distinguished road
Time of stop-loss

Quote:
Originally Posted by phoenix
check the trade history if the ordercloseprice() = orderstoploss() then it close by hit the sl
PHP Code:
   for(int hcnt=0;hcnt<HistoryTotal();hcnt++)
   {
      
OrderSelect(hcntSELECT_BY_POSMODE_HISTORY);
      if(
OrderSymbol()==Symbol())
      {
         if(
OrderClosePrice()==OrderStopLoss())
         .
         .
         .
      }
   } 
Thanks for the idea man. I also wants to know the time of its stop-loss and if that time is in the current bar. I may have lots of stop-losses, but I want to know if it hits the stop-loss in the current time bar. Should I check the order close time and compare it with the time of the current bar?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #324 (permalink)  
Old 08-31-2006, 04:40 PM
Junior Member
 
Join Date: Aug 2006
Posts: 12
billritz is on a distinguished road
Red face showing Buys and Sells on an EA

I'd like to put arrows or text objects or something on the chart while my EA is running to show it's actions, but the objects don't seem to appear. Anybody got a working EA example that draws on the chart?

Also, the Strategy Tester has a button to display a chart after a test is run, but I'm not seeing the arrows. Is this a problem with build 195, because I know I've seen them there in the past. How can we modify these arrow objects? I'd like to make them bigger, but don't know how to get at the chart in the tester either.

I guess both problems are the same: getting user feedback from EAs.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #325 (permalink)  
Old 08-31-2006, 08:17 PM
Junior Member
 
Join Date: Nov 2005
Location: Amman, Jordan
Posts: 22
marketjouster is on a distinguished road
I have an expert that I'm tweaking and wanted to avoid an entry signal if the previously closed bar was extremely long. (>30 pips) I added the phrase below as a condition but it didn't seem to be recognized. I'm not a good coder but have luck with adjusting experts and am learning as I go. Could someone tell me what logic or phrase I should use here?

Under the section;
-----------------------------------
void CheckForSignals() {
-----------------------------------


I included the condition;
-----------------------------------

if ((Close[1])-(Open[1])<30 ) {

buysig=true;
-----------------------------------

Thanks for any suggestions,

MJ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #326 (permalink)  
Old 08-31-2006, 08:37 PM
Member
 
Join Date: Sep 2005
Location: Athens
Posts: 70
Yannis is on a distinguished road
Quote:
Originally Posted by marketjouster
I have an expert that I'm tweaking and wanted to avoid an entry signal if the previously closed bar was extremely long. (>30 pips) I added the phrase below as a condition but it didn't seem to be recognized. I'm not a good coder but have luck with adjusting experts and am learning as I go. Could someone tell me what logic or phrase I should use here?
if ((Close[1])-(Open[1])<30 ) ...
MJ
MJ,
Assuming that Close[1] is for instance 1.2835 and Open[1] is at 1.2805 (bullish bar), the difference is 0.0030 so checking against 30 won't work. Furthermore what if Close[1] is at 1.2805 and Open[1] at 1.2835 (bearish bar)? You'll get -0.0030.
So first of all you need to use Close[1]-Open[1] < (30*Point) to remediate to the first problem, and then you have to use the MathAbs() function to get the absolute value of the subtraction.
In short use: if MathAbs(Close[1]-Open[1])<(30*Point) ....

HTH
Yannis

Last edited by Yannis; 08-31-2006 at 08:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #327 (permalink)  
Old 08-31-2006, 10:21 PM
Junior Member
 
Join Date: Nov 2005
Location: Amman, Jordan
Posts: 22
marketjouster is on a distinguished road
Code to avoid Long Bar trade entry

Quote:
Originally Posted by Yannis
MJ,
Assuming that Close[1] is for instance 1.2835 and Open[1] is at 1.2805 (bullish bar), the difference is 0.0030 so checking against 30 won't work. Furthermore what if Close[1] is at 1.2805 and Open[1] at 1.2835 (bearish bar)? You'll get -0.0030.
So first of all you need to use Close[1]-Open[1] < (30*Point) to remediate to the first problem, and then you have to use the MathAbs() function to get the absolute value of the subtraction.
In short use: if MathAbs(Close[1]-Open[1])<(30*Point) ....

HTH
Yannis
Thanks very much Yannis. Your explanation is very clear and I appreciate the inclusion of the actual code. Could I pose a follow-up question? If I wanted to be able to adjust the number of pips for the long bar in the expert advisors properties window, could I use;

extern int LBE=30; // LBE is 'Long Bar Entry'. Default could be 30

in the header section of the expert and then use LBE instead of 30 in your line of code?

if MathAbs(Close[1]-Open[1])<(LBE*Point)

This would allow me to test variant pip settings manually, and to optimize it in back testing.

MJ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #328 (permalink)  
Old 09-01-2006, 02:40 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 289
phoenix is on a distinguished road
Quote:
Originally Posted by AnasFX
Thanks for the idea man. I also wants to know the time of its stop-loss and if that time is in the current bar. I may have lots of stop-losses, but I want to know if it hits the stop-loss in the current time bar. Should I check the order close time and compare it with the time of the current bar?
in that loop you can check all related whit the order... function

try search the word "order" in the "search" tab of the "Navigation" window
you will find all function about order

to compair with the bar time use Time[0] or iTime(..) function

like if(orderclosetime()>Time[0]) blockopen=true;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #329 (permalink)  
Old 09-01-2006, 03:26 PM
Member
 
Join Date: Sep 2005
Location: Athens
Posts: 70
Yannis is on a distinguished road
Quote:
Originally Posted by marketjouster
Thanks very much Yannis. Your explanation is very clear and I appreciate the inclusion of the actual code. Could I pose a follow-up question? If I wanted to be able to adjust the number of pips for the long bar in the expert advisors properties window, could I use;
extern int LBE=30; // LBE is 'Long Bar Entry'. Default could be 30
in the header section of the expert and then use LBE instead of 30 in your line of code?
if MathAbs(Close[1]-Open[1])<(LBE*Point)
This would allow me to test variant pip settings manually, and to optimize it in back testing.
MJ
MJ,
Sorry for the late reply, you probably have figured out yourself by now, but yes you are correct. This will allow the user to change the value through the ea parameters without modifying your code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #330 (permalink)  
Old 09-01-2006, 08:24 PM
deeforex's Avatar
Member
 
Join Date: Oct 2005
Posts: 91
deeforex is on a distinguished road
Using Arrays to track info for All Open Orders

Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!
dee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex, ZUP_v1.mq4

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 06:12 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.