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
And when the wma amd sma cross it will close the trade on wma 5 and 6
I just can't figure out the logics Thanks again
Turbo_Trader
I could shure use some help
Thanks Much'
Mike
/*[[ Name := Turbo_Trader1.2 Author := Mike Mckeough Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com Lots := 1 Stop Loss := 0 Take Profit := 499 Trailing Stop := 10 ]]*/ defines: Slippage(3); defines: ; var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0); var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k_1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),ma6_1(0),ma6_0(0),ma5_1(0),ma5_0(0),ma2_1(0),ma2_0(0); // Check for invalid bars and takeprofit If Bars<200 then Exit; // Calculate indicators' value rsi3_1 = iRSI(19,1); rsi3_0 = iRSI(19,0); stoc4d_1 = iSTO(10,3,3,MODE_SMA,MODE_SIGNAL,1); stoc4d_0 = iSTO(10,3,3,MODE_SMA,MODE_SIGNAL,0); stoc4k_1 = iSTO(10,3,3,MODE_SMA,MODE_MAIN,1); stoc4k_0 = iSTO(10,3,3,MODE_SMA,MODE_MAIN,0); ma1_1 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,1); ma1_0 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,0); ma6_1 = iMAEx(9,MODE_SMA,0,PRICE_CLOSE,1); ma6_0 = iMAEx(9,MODE_SMA,0,PRICE_CLOSE,0); ma5_1 = iMAEx(9,MODE_LWMA,0,PRICE_CLOSE,1); ma5_0 = iMAEx(9,MODE_LWMA,0,PRICE_CLOSE,0); ma2_1 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,1); ma2_0 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,0); // Note the bid price at crossover point defines: FilterPips(0.0005); var: CrossBid(0),IsBuyingBak(False),IsSellingBak(False) ; // Check for BUY, SELL, and CLOSE signal IsBuying = (ma1_1 <= ma2_1) and (ma1_0 > ma2_0) and (rsi3_0 > 50) and (stoc4d_0 > 50); IsSelling = (ma1_1 >= ma2_1) and (ma1_0 < ma2_0) and (rsi3_0 < 50) and (stoc4d_0 < 50); // Check price filter if (IsBuying and not IsBuyingBak) or (IsSelling and Not IsSellingBak ) then { CrossBid = pricebid ; } IsBuyingBak = IsBuying; IsSellingBak = IsSelling; IsBuying = IsBuying and (PriceBid >= CrossBid + FilterPips); IsSelling = IsSelling and (PriceBid <= CrossBid - FilterPips); IsClosing = (ma5_1 >= ma6_1) and (ma5_0 > ma6_0) or (ma5_1 <= ma6_1) and (ma5_0 < ma6_0); // Control open trades for cnt=1 to TotalTrades { // Control only market trades not entry order if OrderValue(cnt,VAL_TYPE)<=OP_SELL and OrderValue(cnt,VAL_SYMBOL)=Symbol then { // Check for close signal for bought trade If OrderValue(cnt,VAL_TYPE)=OP_BUY then { If IsSelling or IsClosing then { // Close bought trade CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet); Alert("Turbo_Trader1.2: Closing BUY order."); }; // Check trailing stop If TrailingStop>0 then { If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then { // Modify trailing stop ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); }; }; }; } else { // Check sold trade for close signal If IsBuying or IsClosing then { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet); Alert("Turbo_Trader1.2: Closing SELL order."); }; // Control trailing stop If TrailingStop>0 then { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)=0 or OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); }; }; }; }; }; }; // If there is no open trade If TotalTrades<1 then { // If we have enough money for 1 lot If FreeMargin<1000 then Exit; // Check for BUY entry signal If IsBuying and IsSelling=False and IsClosing=False then { // Buy If StopLoss>0 then { RealSL=Ask-StopLoss*Point; } If TakeProfit>0 then { RealTP=Ask+TakeProfit*Point; } SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED); Alert("Turbo_Trader1.2: Buying"); }; // Check for SELL entry signal If IsSelling and IsBuying=False and IsClosing=False then { // Sell If StopLoss>0 then { RealSL=Bid+StopLoss*Point; } If TakeProfit>0 then { RealTP=Bid-TakeProfit*Point; } SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,RED); Alert("Turbo_Trader1.2: Selling"); }; };