交易开拓者ssto策略源码

code=Python width=600px]//------------------------------------------------------------------------

// 简称: ssto

// 名称:

// 类别: 公式应用

// 类型: 用户应用

// 输出:

//------------------------------------------------------------------------

Params

Numeric Length(20); //N                       

Numeric SlowLength(24);   //M1     

Numeric SmoothLength(10);  //M2

Numeric LongLength(20);

Numeric lots(1);

Numeric offset(0);

Numeric stoploss(50);

                  

Vars

NumericSeries HighestValue;                                

NumericSeries LowestValue;                                       

NumericSeries RSV;        

NumericSeries FASTK;

NumericSeries K1;

NumericSeries D1;

Numeric i_offset;

Numeric BuyPosition;

Numeric SellPosition;

Numeric myEntryPrice;                  

Numeric myExitPrice;

                  

Begin

HighestValue = HighestFC(High, Length);

LowestValue = LowestFC(Low, Length);

RSV = (Close-LowestValue)/(HighestValue-LowestValue)*100;

FASTK = SMA(RSV,SlowLength,1);

K1 = SMA(FASTK,SmoothLength,1);

D1 = SMA(K1,LongLength,1);

i_offset = offsetMinMovePriceScale;

if(MarketPosition == 0)

   {

      if(CrossOver(K1,D1))

         {

            buy(lots,Close[1]);

            Return;

                 }                        

          //if(CrossUnder(K1,D1))//开空头

         //{

          // SellShort(lots,Close[1]);

                  // Return;

         //}

        }

   if(MarketPosition == 1)//平多

   {

     if(CrossUnder(K1,D1))

         {

           Sell(lots,Close);

                   Return;

         }

   }

   

   //止损

    If(MarketPosition == 1)

        {

                If(Low EntryPrice + StopLoss MinMovePriceScale)

                {

                        myExitPrice = EntryPrice + (StopLoss+1) MinMovePriceScale;

                        myExitPrice = min(high,myExitPrice);

                        BuyToCover(lots,myExitPrice);

                }

        }     

end
交易技术, 交易策略, 源码, numeric



                                                    风险提示及免责条款

市场有风险,投资需谨慎。本文不构成个人投资建议,也未考虑到个别用户特殊的投资目标、财务状况或需要。用户应考虑本文中的任何意见、观点或结论是否符合其特定状况。据此投资,责任自负。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部