//+------------------------------------------------------------------+ //| P_SAR_Entry.mq4 | //| Copyright © 2009, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" extern int lots = 1.0; extern int slippage = 1; extern int TP = 10; extern int SL = 10; bool isBuying = false, isSelling =false; int start() { int totalOrders = OrdersTotal(); int ticket; double stopLoss, takeProfit; calculateIndicators(); if(totalOrders < 1) { if(isBuying && !isSelling) { stopLoss = Ask - SL*Point; takeProfit = Ask + TP*Point; ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slippage, stopLoss, takeProfit,0,0,0,0); } if(isSelling && !isBuying) { stopLoss = Ask + SL*Point; takeProfit = Ask - TP*Point; ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slippage, stopLoss, takeProfit,0,0,0,0); } } //---- //---- return(0); } //+------------------------------------------------------------------+ void calculateIndicators() { double sarCurrent = iSAR(Symbol(), 0, 0.02, 0.2, 0); double sarPrevious = iSAR(Symbol(), 0, 0.02, 0.2, 1); isBuying = (sarCurrent <= Ask && sarPrevious>sarCurrent); isSelling = (sarCurrent >= Bid && sarPrevious<sarCurrent); }
thanks for responding but unfortunately the code you provided did not open any trades in the test would you know why that is?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
So basically through this long winded question what i want to know is can anyone point me in the direction of a program like this? or be so rediculously awsome as to write it for me?(no im not expecting that just thought it would be cool) anyway thanks for your time. hope some one can help