Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
Forex Forum FAQ Members List Calendar Mark Forums Read


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 Thread Tools
 
Old 06-25-2006, 10:59 PM
BluePearl's Avatar
BluePearl BluePearl is offline
Senior Member
 
Join Date: Oct 2005
Posts: 203
BluePearl is on a distinguished road
do you have an fxdd demo? if so change the color to 0.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 06-25-2006, 11:31 PM
Aaragorn's Avatar
Aaragorn Aaragorn is offline
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
Quote:
Originally Posted by BluePearl
do you have an fxdd demo? if so change the color to 0.
i'm using interbankFX demo. would the color thing prevent it from triggering?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 06-26-2006, 12:09 AM
BluePearl's Avatar
BluePearl BluePearl is offline
Senior Member
 
Join Date: Oct 2005
Posts: 203
BluePearl is on a distinguished road
try it with ibfx. i know it's an issue with fxdd if you use the color name in a modify order command.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 06-26-2006, 03:06 AM
Aaragorn's Avatar
Aaragorn Aaragorn is offline
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
It doesn't seem to change the results. I may have been mistaken in assuming that it should have triggered.

I have 4 reports attached. The only difference between them is the size of the stop loss. This tells me that alot of retracement is going on. That doesn't mean that I want to allow losers to play out to the full stop loss if I can shut them down based on some additional rule that doesn't disproportionally detract from the winners.

Looking at the results from the 186 stop loss report, and looking back at the charts of these 5 losers at their entries. 4 out of 5 of them the bar immediately after opening the position the next bar closed against the position. I don't know if some sort of rule like that could be added like a stop loss to close positions if the very next bar after the position opens goes against it to close the position would work or not. It would have stopped 4 of 5 losers that remained but I don't know how many of the winners it would have also shut down.

I don't know how that kind of rule would be programmed. I just manually walked thru the first 20 trades and it would have shut down 15 of 20 so that won't help.

I'm open for suggestions.
Attached Files
File Type: htm whatever@.4SL186.htm (117.5 KB, 84 views)
File Type: htm whatever@.4SL125.htm (110.5 KB, 25 views)
File Type: htm whatever@.4SL50.htm (79.7 KB, 22 views)
File Type: htm whatever@.4SL20.htm (51.2 KB, 29 views)

Last edited by Aaragorn : 06-26-2006 at 03:44 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 06-28-2006, 01:26 AM
scott TTM scott TTM is offline
Senior Member
 
Join Date: Apr 2006
Posts: 210
scott TTM is on a distinguished road
Someone PLEASE code these from TS for me...

Hi,

Can anyone please code the following indicators for me? They are written in TradeStation's (not)Easylanguage.

if you have trouble then PM/email me

i know it's a LOT of work but will be well worth it once whomever codes it knows what method it is...

SB
Attached Files
File Type: zip Indicators and Functions.zip (28.6 KB, 86 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 06-28-2006, 02:44 AM
Maji Maji is offline
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
Before any one takes up that task, can you explain what the strategies are and give some details, url references for them. If it is an winning strategy, then someone will take up the challenge. Otherwise, why would anyone spend their time translating.

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 07-13-2006, 04:27 PM
fxd01 fxd01 is online now
Member
 
Join Date: Nov 2005
Posts: 78
fxd01 is on a distinguished road
Angry Why doesn't this code work?

I'm trying to write a piece of code that will modify the TP of allexisting trades. When I attach the code to a chart, it works only for the currency where the expert is attached. It does not modify other trades from other currency pairs. Please note that I'm not checking the OrderSymbol()==Symbol() in my code. Where is the mistake? Do I have to add a "return(0)" after each OrderModify()? Can you help me?

Does the expert allow me to open/close/modify trades of a different currency pair while the expert is attached only to a single chart? I'm trying to write a universal code that will process (ie, either modify or close) all existing trades regardless of the chart where the EA is attached to. Can someone please confirm if this is possible at all? If yes, then what is wrong with the following code?



int mTrades=OrdersTotal();
if (mTrades>0)
{
for (i=0;i<mTrades;i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() == OP_BUY)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask+100*Point, White);
}
if (OrderType() == OP_SELL)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid-100*Point, White);
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 07-13-2006, 05:11 PM
elihayun's Avatar
elihayun elihayun is offline
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by fxd01
I'm trying to write a piece of code that will modify the TP of allexisting trades. When I attach the code to a chart, it works only for the currency where the expert is attached. It does not modify other trades from other currency pairs. Please note that I'm not checking the OrderSymbol()==Symbol() in my code. Where is the mistake? Do I have to add a "return(0)" after each OrderModify()? Can you help me?

Does the expert allow me to open/close/modify trades of a different currency pair while the expert is attached only to a single chart? I'm trying to write a universal code that will process (ie, either modify or close) all existing trades regardless of the chart where the EA is attached to. Can someone please confirm if this is possible at all? If yes, then what is wrong with the following code?



int mTrades=OrdersTotal();
if (mTrades>0)
{
for (i=0;i<mTrades;i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() == OP_BUY)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask+100*Point, White);
}
if (OrderType() == OP_SELL)
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid-100*Point, White);
}
}
}
the problem is that u are using Ask and Bid for the price.
Try to use : MarketInfo(OrderSymbol(),MODE_BID) and MarketInfo(OrderSymbol(),MODE_ASK) instead
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 07-13-2006, 05:42 PM
fxd01 fxd01 is online now
Member
 
Join Date: Nov 2005
Posts: 78
fxd01 is on a distinguished road
elihayun,

It makes sense & thanks a lot. I'll try to use MarketInfo() function.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 07-20-2006, 01:07 PM
RJames5541 RJames5541 is offline
Junior Member
 
Join Date: Jul 2006
Posts: 15
RJames5541 is on a distinguished road
Question About Unusual But Effective Indicator: Wich Lines Of Code Are Causing This?

I AM WRITING AND INDICATOR IN MQL4 THAT MEASURES THE BANDWIDTH BETWEEN UPPER AND LOWER BOLLINGER BANDS... FOR SOME REASON WHEN INSTALLED IN THE TRADING TERMINAL NO LINE IS PLOTTED IN THE INDICATOR WINDOW!... I KNOW THE MATH IS WORKING AS THE CORRECT VALUE OF BANDWIDTH IS DISPLAYED IN THE UPPER LEFT-HAND CORNER OF THE INDICATOR WINDOW AS THE PRICE CHANGES. WHY MIGHT THIS BE HAPPENING? I SUSPECT THERE IS SOME SIMPLE THING WRONG WITH MY CODE AS I ONLY BEGAN LEARNING TO PROGRAM 3 DAYS AGO. ANY HELP WOULD BE GREAT!... WHAT LINES OF CODE NEED TO BE ALTERED?

THANKS,
RYAN




//+------------------------------------------------------------------+
//| Band Width of Bollinger Bands .mq4 |
//| Copyright © 2006, Ghostrider Capital LLC. |
//| ryanjmcgregor@tds.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Ghostrider Capital LLC."
#property link "ryanjmcgregor@tds.net"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 DodgerBlue
#property indicator_maximum 1.5
#property indicator_minimum -0.5


//---- indicator parameters
extern int BandsPeriod=20;
extern int BandsShift=0;
extern double BandsDeviations=2.0;
//---- buffers
//---- Moving, Upper, and Lower are for counting to draw Band Width 20
double BandWidth20Buffer[];
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,DodgerBlue );
SetIndexBuffer(0,BandWidth20Buffer);
SetIndexLabel(0,"Band Width 20");

SetIndexBuffer(1,MovingBuffer);
SetIndexBuffer(2,UpperBuffer);
SetIndexBuffer(3,LowerBuffer);

//----
//---- 4 Indicators Buffers Mapping
SetIndexDrawBegin(0,0);
// SetIndexDrawBegin(1,BandsPeriod+BandsShift);
// SetIndexDrawBegin(2,BandsPeriod+BandsShift);
// SetIndexDrawBegin(3,BandsPeriod+BandsShift);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2 );
IndicatorShortName("Band Width of 20 2.0 BB");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
double deviation;
double sum,oldval,newres,upper,lower,middle;

//----
if(Bars<=BandsPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=BandsPeriod;i++)
{
MovingBuffer[Bars-i]=EMPTY_VALUE;
UpperBuffer[Bars-i]=EMPTY_VALUE;
LowerBuffer[Bars-i]=EMPTY_VALUE;
BandWidth20Buffer[Bars-i]=EMPTY_VALUE;
}
//----
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
for(i=0; i<limit; i++)
MovingBuffer[i]=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_ CLOSE,i);
middle=MovingBuffer[i];
//----
i=Bars-BandsPeriod+1;
if(counted_bars>BandsPeriod-1) i=Bars-counted_bars-1;
while(i>=0)
{
sum=0.0;
k=i+BandsPeriod-1;
oldval=MovingBuffer[i];
while(k>=i)
{
newres=Close[k]-oldval;
sum+=newres*newres;
k--;
}
deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
UpperBuffer[i]=oldval+deviation;
LowerBuffer[i]=oldval-deviation;
upper=UpperBuffer[i];
lower=LowerBuffer[i];
//---- Formula Band Width = (Upper - Lower) / Middle Band moving sma
BandWidth20 Buffer[i]=(upper-lower)/middle;

i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
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 04:22 PM


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