Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


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

 
 
LinkBack (1) Thread Tools
 
Old 09-11-2007, 07:57 PM
Member
 
Join Date: Feb 2006
Posts: 53
icm63 is on a distinguished road
Question Fire code immediately after 15 minute bar finishes

I have a trailing stop, it up dates every tick during a 15 min bar, and the stop is calculated 20 pip from BID price.

But I would prefer that the trailing stop calculates at the end of the of the most recent 15 minute bar.

So this would this be on a BUY
if( BID > High[1] - (20 * Point)) StopLoss = High[1] - (20 * Point);

So this is to allow the current 15 minute bar to whipsaw around as much as it likes, before stops are moved.

Is this the idea, or are there others out there ?? Thx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-12-2007, 02:19 AM
Dan7974's Avatar
Senior Member
 
Join Date: Jul 2006
Posts: 264
Dan7974 is on a distinguished road
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


?????????????
__________________
God Bless Everyone, and their trading logic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-12-2007, 02:27 AM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Smile Need Profit Display Coding Help!!!!!

PHP Code:
//---- Pips Profit///////////////////////////////////////////////////////////////////////////////////////////////////////////////

  
int j,total=OrdersTotal();
  for(
j=0;j<total;j++)

  
OrderSelect(jSELECT_BY_POSMODE_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_LABEL000);
  
ObjectSetText("pips_profit",pips_profit,14"Verdana"White);//color_of_pipsprofit);
  
ObjectSet("pips_profit"OBJPROP_CORNER3);
  
ObjectSet("pips_profit"OBJPROP_XDISTANCE34);
  
ObjectSet("pips_profit"OBJPROP_YDISTANCE18); 

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
<><<<

Last edited by 1Dave7; 09-12-2007 at 04:04 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-12-2007, 03:27 AM
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
Originally Posted by Dan7974 View Post
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-12-2007, 05:05 AM
Dan7974's Avatar
Senior Member
 
Join Date: Jul 2006
Posts: 264
Dan7974 is on a distinguished road
Quote:
Originally Posted by omelette View Post
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!!!
__________________
God Bless Everyone, and their trading logic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-12-2007, 07:08 PM
coz coz is offline
Junior Member
 
Join Date: Aug 2007
Posts: 4
coz is on a distinguished road
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-13-2007, 10:00 PM
Member
 
Join Date: Dec 2005
Posts: 35
fire_starta is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-13-2007, 11:24 PM
Neo Neo is offline
Member
 
Join Date: Jun 2006
Posts: 34
Neo is on a distinguished road
I'm sure I can help - can you expand a bit?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-14-2007, 03:19 PM
keymaker's Avatar
Junior Member
 
Join Date: Sep 2007
Posts: 17
keymaker is on a distinguished road
Smile *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

Last edited by keymaker; 09-14-2007 at 03:22 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-17-2007, 05:38 AM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Question 2 Steps Back With This Indicator

USING THIS INDICATOR IN AN EA:
PHP Code:
  DAYHIGH=iCustom(NULL,0,"dayHL",0,0); 
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 Code:
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
Attached Files
File Type: mq4 dayHL.mq4 (3.2 KB, 9 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Bookmarks

Tags
candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading
Thread Tools

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/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 07:24 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 09:12 PM.



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