Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
Thread Tools Display Modes
  #871 (permalink)  
Old 05-04-2008, 08:53 AM
birami's Avatar
Member
 
Join Date: Nov 2006
Posts: 32
birami is on a distinguished road
CHinGsMAroonCLK ea

hello
can anyone add sl for this expert .
Id like all orders have a fix sl
Attached Files
File Type: mq4 CHinGsMAroonCLK_2[1][1].2.mq4 (8.3 KB, 27 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #872 (permalink)  
Old 05-04-2008, 10:03 AM
ak97052d's Avatar
Junior Member
 
Join Date: Apr 2006
Location: Ukraine
Posts: 25
ak97052d is on a distinguished road
Quote:
Originally Posted by birami View Post
hello
can anyone add sl for this expert .
Id like all orders have a fix sl
hello
try this !
Attached Files
File Type: mq4 chingsmaroonclk_2-1-1-.2+sl.mq4 (8.4 KB, 42 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #873 (permalink)  
Old 05-04-2008, 10:40 AM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by flourishing View Post
how to make comment(1 / 2) display 0.5 ?
thank you.
Please, try this:
PHP Code:
Comment(DoubleToStr(1/21)); 
The second argument of the function DoubleToStr() is the number of digits after the decimal point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #874 (permalink)  
Old 05-04-2008, 10:59 AM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by ak97052d View Post
hello
how to code this:
I need to extract some info from last closed trade,
and after use some info from this last trade
ex:
if last trade profit >0 'lasttradeprofit = 1'

and if last trade <=0 'lasttradeprofit = 0'

lasttradeprofit = 1 // if last trade >0
lasttradeprofit = 0 // if last trade <=0

thanks
It's easy to scan the history and check OrderCloseTime() :
PHP Code:
datetime LastCloseTime;
bool LastTradeIsProfit;
for(
int i 0OrderHistoryTotal(), ++)
{
   
OrderSelect(iSELECT_BY_POSMODE_HISTORY);
   if(
OrderMagicNumber() != Magic) continue;
   if(
OrderCloseTime() > LastCloseTime
   {
      
LastCloseTime OrderCloseTime();
      
LastTradeIsProfit  = (OrderProfit() > 0);
   } 

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #875 (permalink)  
Old 05-04-2008, 02:16 PM
birami's Avatar
Member
 
Join Date: Nov 2006
Posts: 32
birami is on a distinguished road
Quote:
Originally Posted by ak97052d View Post
hello
try this !
thank you for edite expert
can you change this ea using my idea
from my idea after opening two orders we explain this info
1- all orders have fix stop loss same 10pip
2-if the first order going to profit opening 2* same this order but tp=fist order tp-fix sl
3- traling sl to second order opening place

exampel:
eur/usd
on the first price is : 1.5200
1-opening two orders ( buy@ 1.5200 0.1 lot size sl=10 tp 50 & sell@1.5200 0.1 lot size sl=10 tp=50)
price go to 15210
2-at this time (my sell order will be close & will opening second buy order 0.2 lot size by sl=10 tp=40 and fist order sl traling to 1.5210 )
price go to 1.5220
3-at this time (opening buy order 0.4 lot size by sl=10 tp=30 and two befor orders sl traling to 1.5220)
4-.....
5....
if the price going to 1.5250 all orders will be close by 560$
but at this time our orders sl we only lossing 60$
this method have very best risk

Last edited by birami; 05-04-2008 at 02:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #876 (permalink)  
Old 05-04-2008, 03:19 PM
birami's Avatar
Member
 
Join Date: Nov 2006
Posts: 32
birami is on a distinguished road
Quote:
Originally Posted by ak97052d View Post
hello
try this !
excuse me this expert sl have to using this formul for having profit result on thefix sl have bad result
order sl = ((MaxTrades*MinGS)+SL) - (n*MinGS)
exampel for this info
extern int MinGS=5;
extern int TP=20;
extern int SL=10;
extern double lot=0.10;
extern int MaxTrades=7;
extern int RegularSpread=2;
extern double Multiplier=2;
extern double LotInc=0;
extern double MarginLevelAlert=1000;

we have
first order sl= ((7*5)+10)-(0*5)=40
second order sl= ((7*5)+10)-(1*5)=35
and other sl are
35
30
25
20
15
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #877 (permalink)  
Old 05-04-2008, 06:53 PM
Member
 
Join Date: Mar 2007
Posts: 33
Nordic12 is on a distinguished road
Help with an indicator

Hi

Ive tried to create an indicator and was wondering to see if someone can help me (i feel its 99.9% finished - well phase I anyway)




//+------------------------------------------------------------------+
//| CCI_Stoc_Xover.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 SeaGreen
#property indicator_color2 Red

extern int CCI_Period = 14;
extern int Stoc_K=5;
extern int Stoc_D=3;
extern int Stoc_Slowing=3;

double CrossUp[];
double CrossDown[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY,3);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY,3);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i, counter;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

for(i = 0; i <= limit; i++) {

counter=i;
double cci_1 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 1);
double cci_2 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 2);
double stok_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 0);
double stod_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 0);
double stok_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 1);
double stod_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 1);

if ((cci_2 <= 0 && cci_1 > 0 && stok_1 < stod_1 && stok_0 > stod_0)) {
CrossUp[i] = Low[i];
}
else if ((cci_2 >= 0 && cci_1 < 0 && stok_1 > stod_1 && stok_0 < stod_0)) {
CrossDown[i] = High[i];
}
}
return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #878 (permalink)  
Old 05-05-2008, 05:21 PM
Member
 
Join Date: Oct 2006
Posts: 80
Big Be is on a distinguished road
Wolfe's Question

Quote:
Originally Posted by wolfe View Post
Does anyone know how to code so that when you call an indicator in an EA it automatically attaches the called indicator to the chart your EA is attached to? This way it would visually be in the exact same time as what is being read by your EA.

Thanks.
The previous reply was incomplete.
If the indicator is standard in MT4, it will show up in the normal place. If it is called by iCustom, it will also show up, if coded right.
The following EAs even have the indicators show on the chart window. Study them to learn how:

bouncingPipEA_mpowerV42.mq4
bouncingPipEA_BigBear_v23.mq4

Big Be
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #879 (permalink)  
Old 05-07-2008, 03:19 AM
Junior Member
 
Join Date: Mar 2008
Posts: 13
mastoto is on a distinguished road
Spread in Pending Order

Hi folks,

I made an EA that calculates daily hi-low between some period, and then place pending orders buystop/sellstop, that will expired in 12 hours.
I run it in GBP-JPY pair (8 pips spread in my broker)
Code:
int ticket, SL, TP; //SL= StopLoss , TP= TakeProfit
int Spacing = 10; // Spacing Pips 
double vAsk = HighestPrice+Spacing*Point;  //  raise/lower 10 pips for OP Buystop/Sellstop , HighestPrice= some highest price  

ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,vAsk,0,vAsk-SL*Point,vAsk+TP*Point,"Pending Order BUY STOP",20070125,CurTime() + 12 * 3600,Green);
The result, Pending Order Buy Stop was executed, even price did not touch it. I have traced the OP Buy Stop, placed at price 204.08, but it was executed when the price is at 204.00. It seems that Spread factor is involved.
My friend told me that manual Pending Order Buystop/Sellstop is executed without spread factor, but why it's different with placing order by EA ?

So is there any mistakes in my code ?

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #880 (permalink)  
Old 05-07-2008, 06:35 AM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by mastoto View Post
Hi folks,

I made an EA that calculates daily hi-low between some period, and then place pending orders buystop/sellstop, that will expired in 12 hours.
I run it in GBP-JPY pair (8 pips spread in my broker)
Code:
int ticket, SL, TP; //SL= StopLoss , TP= TakeProfit
int Spacing = 10; // Spacing Pips 
double vAsk = HighestPrice+Spacing*Point;  //  raise/lower 10 pips for OP Buystop/Sellstop , HighestPrice= some highest price  

ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,vAsk,0,vAsk-SL*Point,vAsk+TP*Point,"Pending Order BUY STOP",20070125,CurTime() + 12 * 3600,Green);
The result, Pending Order Buy Stop was executed, even price did not touch it. I have traced the OP Buy Stop, placed at price 204.08, but it was executed when the price is at 204.00. It seems that Spread factor is involved.
My friend told me that manual Pending Order Buystop/Sellstop is executed without spread factor, but why it's different with placing order by EA ?

So is there any mistakes in my code ?

Thanks in advance.
If your "HighestPrice" is a BID price as they are on all charts, you probably have to add the spread. Any BUY order is triggered by a ASK price.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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 02:13 PM.



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