Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
Forex Forum Register FAQ Members List Calendar Search Today's Posts 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

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 02-20-2006, 05:12 AM
konjn's Avatar
konjn konjn is offline
Junior Member
 
Join Date: Jan 2006
Posts: 4
konjn is on a distinguished road
similar boat

I'm up against the same thing... but instead of having a line (more clutter) i'd like to ahve a candle colored... again it needs to be user input so we can show the opens of various markets... as an example.

konjn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 02-23-2006, 10:42 AM
gqjs gqjs is offline
Junior Member
 
Join Date: Feb 2006
Posts: 7
gqjs is on a distinguished road
about code of mql4




i want to put the hight and low price in current chart .

but i do not konw how to write the code in my indicator by MQL4.

thanks a lot!

Last edited by gqjs : 02-23-2006 at 10:45 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 02-23-2006, 10:43 AM
gqjs gqjs is offline
Junior Member
 
Join Date: Feb 2006
Posts: 7
gqjs is on a distinguished road
like these


Last edited by gqjs : 02-23-2006 at 11:42 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #24 (permalink)  
Old 02-23-2006, 11:06 AM
divergence_trader divergence_trader is offline
Junior Member
 
Join Date: Feb 2006
Posts: 9
divergence_trader is on a distinguished road
Code to move stoploss?

Hi all,

Coding an EA at the moment to autotrade for me, it's getting towards completion but i can't figure out how to move the stoploss on an open trade. i am posting my code here, if anyone could point out what i'm doing wrong i would greatly appreciate


This is the part of code which opens a LONG position:

PHP Code:

{
         if(
//long entry criteria met)
            
{
            if (
priorbartime == Time[0])
            return(
0);
            
priorbartime Time[0];
            
Alert("Long Signal");
            
ObjectCreate(arrowlongOBJ_ARROW0Time[0], Open[0], 0000);
            
ObjectSet(arrowlongOBJPROP_ARROWCODE233);
            
ObjectSet(arrowlongOBJPROP_COLORAqua);
            
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask-StopLoss*Point,Ask+TakeProfit*Point,"am crossing",16677,0,Green);  // HDB CHANGED Close TO Ask and SlipPage to 0
         
if(ticket>0)
           {
            if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
           }
         else Print(
"Error opening BUY order : ",GetLastError()); 
         return(
0);
            }
    } 
then once the trade is open I want to manage it by moving stop to -5 when the trade is +15, and by moving stop to b/e when trade is +20. this is the code i have come up with so far but it doesnt seem to be working:

PHP Code:
total=OrdersTotal();
   if(
total>0)
      { 
      for(
cnt=0;cnt<total;cnt++)
         {
         
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
         if(
OrderType()==OP_BUY && OrderSymbol()==Symbol())
            {
            if(
Bid-OrderOpenPrice()==Point*15)
               {
               
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*5,OrderTakeProfit(),0,Blue);
               return(
0);
               }
            if(
Bid-OrderOpenPrice()==Point*20)
               {
               
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Blue);
               return(
0);
               }
            }
         }
      } 
As mentioned, this is all for LONG positions.

Thanks for any help!

divergence_trader
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #25 (permalink)  
Old 02-23-2006, 11:24 AM
newdigital newdigital is online now
Administrator
 
Join Date: Sep 2005
Posts: 14,358
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Many people asked about it already many times.
So read:
- this post,

- this one and

- this Codersguru thread.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #26 (permalink)  
Old 02-23-2006, 11:31 AM
divergence_trader divergence_trader is offline
Junior Member
 
Join Date: Feb 2006
Posts: 9
divergence_trader is on a distinguished road
thanks newdigital, i'ev looked round many threads at SBFX, metaquotes and here but managed to not find what i was looking for, hopefully these will help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #27 (permalink)  
Old 02-23-2006, 06:17 PM
Nicholishen's Avatar
Nicholishen Nicholishen is offline
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
Try this:

PHP Code:
   total=OrdersTotal();
   if(
total>0){ 
      for(
cnt=0;cnt<total;cnt++){
         
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
         if(
OrderType()==OP_BUY && OrderSymbol()==Symbol()){
            if(
Bid-OrderOpenPrice()>=Point*15 &&  Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){
               
OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue);
            }
            if(
Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){
               
OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue);
            }
         }
      }
   } 

Last edited by Nicholishen : 02-23-2006 at 06:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #28 (permalink)  
Old 02-25-2006, 08:15 PM
mas mas is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
mas is on a distinguished road
code of MA levels

hi

i try to write a code of MA levels but it's not working ...

any one can tell me how can i do it plz.

thanks
Attached Images
File Type: png levels.PNG (19.6 KB, 497 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #29 (permalink)  
Old 02-25-2006, 11:58 PM
keris2112's Avatar
keris2112 keris2112 is offline
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 129
keris2112 is on a distinguished road
Quote:
Originally Posted by mas
hi

i try to write a code of MA levels but it's not working ...

any one can tell me how can i do it plz.

thanks
You can use the Vegas Currancy Daily indicator as a guide. See attachement.
Keris
Attached Files
File Type: mq4 Vegas Currency Daily.mq4 (5.9 KB, 189 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #30 (permalink)  
Old 02-28-2006, 10:27 AM
divergence_trader divergence_trader is offline
Junior Member
 
Join Date: Feb 2006
Posts: 9
divergence_trader is on a distinguished road
Quote:
Originally Posted by Nicholishen
Try this:
Thanks Nicholishen, your code works perfectly. Didn't get an opportunuity to test it in a live market until now but all working fine. thanks again!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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 04:22 PM.