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

Reply
 
LinkBack (1) Thread Tools Display Modes
  #1261 (permalink)  
Old 09-05-2008, 10:10 PM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Question Help with #property indicators

I am trying to code an indicator to change the indicator color using a "if" conditional statement with no success.

PHP Code:
if(PeakUp==True)
{
#property indicator_color4 Lime
}
if(
PeakUp==True)
{
#property indicator_color3 CLR_NONE
}


if(
PeakUp==False)
{
#property indicator_color4 CLR_NONE
}
if(
PeakUp==False)

{
#property indicator_color3 Red


Can anybody help??


Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1262 (permalink)  
Old 09-05-2008, 10:58 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
:: you can't use "property" in a code, just use "color" to a normal variable name in your if statement. like... color indic.1=Lime

:: then use the color outcome in a SetIndexStyle() (look this up in you manual) but will be like...
SetIndexStyle(0,DRAW_LINE,0,0,indic.1);
:: put all of this in your init() function

:: check in your manual where & how the #property must be placed, they have different aspects to consider.
IN10TION
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart

Last edited by IN10TION; 09-05-2008 at 11:02 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1263 (permalink)  
Old 09-06-2008, 12:51 AM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile

Thanks, I think I can try this.

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1264 (permalink)  
Old 09-07-2008, 09:20 PM
Badguy's Avatar
Member
 
Join Date: Jan 2006
Posts: 46
Badguy is on a distinguished road
EA with Close by time and day

Hi coders

i have try to create a EA with followin options:

Start by selected Hours and Time.

It seems as if this function is working.

The other option i like to have is:

Close all trades at selected Hour an Time.

Please see my EA-Template, that i have wrote.

Somebody can help an old man?
Attached Files
File Type: mq4 # 1 EA_Test_Template v1.1.mq4 (14.5 KB, 9 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1265 (permalink)  
Old 09-08-2008, 03:12 AM
Junior Member
 
Join Date: Aug 2007
Posts: 9
mish is on a distinguished road
Locking in first initial value of OrderOpenPrice()

Does anyone know of a way to lock in the first occurrence of the value of OrderOpenPrice()?

for example double x=OrderOpenPrice(); but I never want the values to change
upon sale of the order or renewing the order

I need x to act as a reference point

any help greatly appreciated

thankyou
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1266 (permalink)  
Old 09-08-2008, 05:14 AM
Senior Member
 
Join Date: Nov 2006
Posts: 215
luxinterior is on a distinguished road
You could either write the price as a comment then move it to each order until such time as you want to change it, use a global variable or write to file.

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1267 (permalink)  
Old 09-08-2008, 12:39 PM
Junior Member
 
Join Date: Jan 2008
Posts: 1
g_r_a_robinson is on a distinguished road
Trying to get swing high/low code to work on patterns other than pins

Hi,

I have an EA that calls an indicator which tells me if the price is at a swing high/low. It works fine on the current bar, so for e.g if its a pinbar and its at a swing high/low then my EA creates a buy/sell entry. Its works great as long as my EA picks up pinbars. But its no good if I need to make the entry on say an inside bar at a swing high/low because the high/low bar as passed.

This code will work for the close of the first bar but I need the code to work for close of the second or third. In other words I need a way for my EA to remember that the price is at the high/low for a few bars after the high/low.

(prevtime != Time[0])
{
DeleteSellLimit();
}
prevtime = Time[0];
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1268 (permalink)  
Old 09-08-2008, 03:47 PM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile

PHP Code:
#property indicator_color1 Magenta
#property indicator_color2 Yellow


extern bool TrendDirectionUp=true;

string Color1;
string Color2;

int init()  {

if(
TrendDirectionUp==true){
Color1=Yellow;
Color2=CLR_NONE;
}

if(
TrendDirectionUp==false){
Color1=CLR_NONE;
Color2=Magenta;
}

   
SetIndexStyle(0,DRAW_ARROW,0,star_size,Color1);
   
SetIndexStyle(1,DRAW_ARROW,0,star_size,Color2);
   
SetIndexArrow(0,172);//333
   
SetIndexArrow(1,172);//334
   
SetIndexBuffer(0,b1);
   
SetIndexBuffer(1,b2);

   return(
0);



Right now, both Color(s) 1 & 2 show 'black' on the graph!!

Can any expert Guru help me solve this issue???

Thanks in Advance!

Last edited by Dave137; 09-11-2008 at 03:24 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1269 (permalink)  
Old 09-09-2008, 12:09 AM
Senior Member
 
Join Date: Nov 2006
Posts: 215
luxinterior is on a distinguished road
instead of having startcolor as a string have it as a color

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1270 (permalink)  
Old 09-09-2008, 06:00 AM
darkkiller's Avatar
Senior Member
 
Join Date: Jul 2007
Location: Malaysia
Posts: 207
darkkiller is on a distinguished road
I would like to know,can we code using chinese or arabic font inside indicator and the text will be show on the chart?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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

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/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 12:15 PM.



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