Just a variation of the trade script that comes with mt4.
All I have to do is click at and it trades Long at Market with a default stop of 10 pips and a target of 30 pips. Risked amount is 5% of your account balance.
I've compiled it and its fine but it keeps coming up with an error "Invalid stoploss" when I try it use it.
I've checked this several times and I can't see anything wrong with what I set for the stoploss though, any ideas?
Appreciate your time,
Scotty
All I have to do is click at and it trades Long at Market with a default stop of 10 pips and a target of 30 pips. Risked amount is 5% of your account balance.
I've compiled it and its fine but it keeps coming up with an error "Invalid stoploss" when I try it use it.
I've checked this several times and I can't see anything wrong with what I set for the stoploss though, any ideas?
Appreciate your time,
Scotty
Inserted Code
//+------------------------------------------------------------------+ //| Go Long.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| [url]http://www.metaquotes.net/[/url] | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "[url]http://www.metaquotes.net/[/url]" #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); //---- double lots1 = ((AccountBalance()*0.05)/100); double lots = NormalizeDouble(lots1, 2); Print(lots); Print(Ask); Print(Ask-0.0010); Print(Ask+0.0030); int ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,3,Ask-0.0010,Ask+0.0030,"expert comment",255,0,CLR_NONE); if(ticket<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } //---- OrderPrint(); return(0); } //+------------------------------------------------------------------+