You could modifiy the Trade Script shown below
//+------------------------------------------------------------------+ //| trade.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include <stdlib.mqh> #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { //---- if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price? ", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1); //---- int ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,CLR_NONE); if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- OrderPrint(); return(0); } //+------------------------------------------------------------------+
make two of these one for buy situation and one for sell and get the script to send two trades
for example
//+------------------------------------------------------------------+ //| trade.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include <stdlib.mqh> #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { //---- if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price? ", //stops accidental order placement "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1); //---- int ticket=OrderSend("EURUSD",OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- int ticket=OrderSend("USDCHF",OP_SELL,1.0,Bid,3,0,0,"expert comment",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- return(0); } //+------------------------------------------------------------------+
Not tested above example
OK... I need help with it. I started writing my own ea... but I am a newbie at Forex, and MT4 programing.
Right now I'm stuck on how to reference the price of the overlay data. where it plots on the chart, is not what the actual price is.
But I need to know how to reference, in my ea code, the price that is showing on the chart... not the actual price.
Any ideas.?
can someone help me edit sar ohlc to use heiken ashi ohlc
Hi, I have an MTF indicator that uses sar, however I'd like the sar to calculate heiken ashi ohlc, and not the normal type
Can you tell me how I can do this, my mtf indicator calls to the sar indicator to calculate sar formula, I think it is calling to the internal indicator in mt4 that can not edit
you can skype or email if you can assist and like to talk about it
skype sty671
email sty671@gmail.com
I can also supply the original file that I'm trying to use heiken ashi ohlc for
can someone help me edit sar ohlc to use heiken ashi ohlc
You could modifiy the Trade Script shown below
make two of these one for buy situation and one for sell and get the script to send two trades
for example
Not tested above example
OK... I've been working with this one. I cant get it to open both positions... it only opens the one for the chart that is open at the time.
Am I missing something? Is there a way to have it open both, and then stick around to close both at the same time with the push of one button?
Sorry there is a small error which occured because of the speed of reply it lies in the "Ask" and The "Bid" prices.
You need the Ask and Bid price of the alternate currency otherwise the OrderSend will reject the order.
To get the price of a symbol/currency pair not belonging to the chart you are using (i.e off chart) use:-
double alt_bid =MarketInfo("EURUSD",MODE_BID);
double alt_ask =MarketInfo("EURUSD",MODE_ASK);
so modifying my previous suggestion we get
//+------------------------------------------------------------------+ //| trade.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include <stdlib.mqh> #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { double alt_bid ; double alt_ask ; //---- if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price? ", //stops accidental order placement "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1); alt_bid = MarketInfo("EURUSD",MODE_BID); alt_ask = MarketInfo("EURUSD",MODE_ASK); //---- int ticket=OrderSend("EURUSD",OP_BUY,1.0,alt_ask,3,0,0,"expert comment",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- alt_bid = MarketInfo("USDCHF",MODE_BID); alt_ask = MarketInfo("USDCHF",MODE_ASK); int ticket=OrderSend("USDCHF",OP_SELL,1.0,alt_bid,3,0,0,"expert comment",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- return(0); } //+------------------------------------------------------------------+
The above (not tested) should place a BUY on the currency pair EUR/USD and a SELL on currency pair USD/CHF and should not care what chart you place the script on.
If you use Symbol() then you are using the default currency pair of the chart you place the script on and the Ask and Bid prices will be those of the Chart you are using - please accept my appology for the stupid error.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Does anyone know of a free ea that will open a buy order with one pair, and a sell order for another pair at the same time?
And also close the two orders at the same time when the right time comes?
For example: I am overlaying two charts... (could be any two charts, like EURUSD /CHFJPY, or GBPJPY/USDJPY etc..)
When I visually see an entry point, I want to have the ea instantly open apposing orders at the lot size I specify.
I need to be able to choose which one is long, and which one is short.
When I visually see an exit point, I want to have the ea close the two orders at the same time.
Anything out there like that?
MrChuck