您现在的位置:程序化交易>> 期货公式>> 文华财经>> 文华财经知识>>正文内容

[求助]麻烦老师了 [文华财经]

  • 咨询内容:  麻烦老师改成文化可用的
    Params      Numeric Length(40);      Numeric NumATRs(1);  Numeric Offset(1);  Numeric ATRLength(10);  Numeric TrailingStart(1);  Numeric StopLossSet(4);  Numeric TrailingStop(3);Vars      NumericSeries TPrice;      Numeric AvgValue;      NumericSeries ShiftValue;      Numeric UpperBand;      Numeric LowerBand;      Numeric MyPrice;  Numeric UpLine; //上轨  Numeric DownLine; //下轨   NumericSeries MidLine; //中间线  Numeric Band;  NumericSeries HigherAfterEntry;  NumericSeries LowerAfterEntry;  Numeric DayOpen;  Numeric StopLine;  BoolSeries bLongTrailingStoped;      BoolSeries bShortTrailingStoped;  Numeric MinPoint;Begin     MinPoint = MinMove*PriceScale;     DayOpen=AvgEntryPrice; TPrice=(High[1]+Low[1]+Close[1])/3;     AvgValue=AverageFC(TPrice,Length);     ShiftValue=NumATRs*AvgTrueRange(ATRLength);     UpperBand=AvgValue+ShiftValue[1];     LowerBand=AvgValue-ShiftValue[1]; MidLine = AverageFC(Close,Length); Band = StandardDev(Close,Length,2);  UpLine = MidLine + Offset * Band; DownLine = MidLine - Offset * Band;   If(BarStatus > 0){ bLongTrailingStoped = bLongTrailingStoped[1]; bShortTrailingStoped = bShortTrailingStoped[1];}Commentary("bLTrue","False"));Commentary("bShortTrailingStoped="+IIFString(bShortTrailingStoped,"True","False"));
    If(BarsSinceEntry==1){    HigherAfterEntry=AvgEntryPrice;    LowerAfterEntry=HigherAfterEntry;}Else// If(BarsSinceEntry>1){       HigherAfterEntry=max(HigherafterEntry[1],High[1]);       LowerAfterEntry=min(LowerAfterEntry[1],Low[1]);}If(bLongTrailingStoped==False && MarketPosition!=1&&High>=UpperBand)   {      MyPrice=UpperBand;      If(Open>MyPrice)MyPrice=Open;      Buy(1,MyPrice);  bLongTrailingStoped=True;  bShortTrailingStoped=False;      Return;   }If(bShortTrailingStoped==False && MarketPosition!=-1&&Low<=LowerBand){     MyPrice=LowerBand;     If(Open<MyPrice)MyPrice=Open;     SellShort(1,MyPrice);  bShortTrailingStoped=True; bLongTrailingStoped=False;     Return;}If(HigherAfterEntry>=AvgEntryPrice+DayOpen*TrailingStart*0.01&&MarketPosition==1){       StopLine=HigherAfterEntry-DayOpen*TrailingStop*0.01;}Else//止损{       StopLine=UpperBand-DayOpen*StopLossSet*0.01;}If(Low<=StopLine){       MyPrice=StopLine;       If(Open<MyPrice)MyPrice=Open;       Sell(1,MyPrice);   bLongTrailingStoped=True;   bShortTrailingStoped=False;       Return;}If(LowerAfterEntry<=AvgEntryPrice-DayOpen*TrailingStart*0.01&&MarketPosition==-1){       StopLine=LowerAfterEntry+DayOpen*TrailingStop*0.01;}Else//止损{       StopLine=LowerBand+DayOpen*StopLossSet*0.01;}
    If(High>=StopLine){       MyPrice=StopLine;       If(Open>MyPrice)MyPrice=Open;       Buytocover(1,MyPrice); bShortTrailingStoped=True; bLongTrailingStoped=False;       Return;}

    //再次入场的代码If(bLongTrailingStoped && MarketPosition==0 && High > HigherAfterEntry){ MyPrice = HigherAfterEntry + MinPoint; If(Open > MyPrice) MyPrice = Open; Buy(1,MyPrice); bLongTrailingStoped = False; bShortTrailingStoped= True; Return;}If(bShortTrailingStoped && MarketPosition==0 && Low < LowerAfterEntry){ MyPrice = LowerAfterEntry - MinPoint; If(Open < MyPrice) MyPrice = Open; SellShort(1,MyPrice); bLongTrailingStoped = True; bShortTrailingStoped= False; Return;}End

     

     来源:程序化99

  • 文华技术人员:  我们提供程序化软件MQ,类似C语言的语法结构,兼容了您上面模型的语法,简单修改后即可使用
    您下载MQ试下,如果您不会改,我们再帮您分析下
    MQ地址 https://mq.wenhua.com.cn/
     

     

     来源: WWW.CXH99.COM

  • 文华客服:  老师,复制到MQ还是不行,提示


    文件名:sgz1g(od(zuhecco5}s4icc.png
     麻烦老师改为MQ可以用的

     

  • 网友回复: 参考:
    Params       Numeric Length(40);       Numeric NumATRs(1);
     Numeric Offset(1);
     Numeric ATRLength(10);
     Numeric TrailingStart(1);
     Numeric StopLossSet(4);
     Numeric TrailingStop(3); Vars       NumericSeries TPrice;       Numeric AvgValue;       NumericSeries ShiftValue;       Numeric UpperBand;       Numeric LowerBand;       Numeric MyPrice;
     Numeric UpLine; //上轨
     Numeric DownLine; //下轨 
     NumericSeries MidLine; //中间线
     Numeric Band;
     NumericSeries HigherAfterEntry;
     NumericSeries LowerAfterEntry;
     Numeric DayOpen;
     Numeric StopLine;
     NumericSeries bLongTrailingStoped;        NumericSeries bShortTrailingStoped;
     Numeric MinPoint; Begin      MinPoint = MinMove*PriceScale;      DayOpen=AvgEntryPrice;
    TPrice=(High[1]+Low[1]+Close[1])/3;      AvgValue=AverageFC(TPrice,Length);      ShiftValue=NumATRs*AvgTrueRange(ATRLength);      UpperBand=AvgValue+ShiftValue[1];      LowerBand=AvgValue-ShiftValue[1];
    MidLine = AverageFC(Close,Length);
    Band = StandardDev(Close,Length,2); 
    UpLine = MidLine + Offset * Band;
    DownLine = MidLine - Offset * Band; 
      If(BarStatus > 0) {
    bLongTrailingStoped = bLongTrailingStoped[1];
    bShortTrailingStoped = bShortTrailingStoped[1]; } //Commentary("bLTrue,"False")); Commentary("bShortTrailingStoped="+IIFString(bShortTrailingStoped,"True","False"));

    If(BarsSinceEntry==1) {     HigherAfterEntry=AvgEntryPrice;     LowerAfterEntry=HigherAfterEntry; }Else// If(BarsSinceEntry>1) {        HigherAfterEntry=max(HigherafterEntry[1],High[1]);        LowerAfterEntry=min(LowerAfterEntry[1],Low[1]); } If(bLongTrailingStoped==0&& MarketPosition!=1&&High>=UpperBand)    {       MyPrice=UpperBand;       If(Open>MyPrice)MyPrice=Open;       Buy(1,MyPrice);
     bLongTrailingStoped=1;
     bShortTrailingStoped=0;       Return;    } If(bShortTrailingStoped==0 && MarketPosition!=-1&&Low<=LowerBand) {      MyPrice=LowerBand;      If(Open<MyPrice)MyPrice=Open;      SellShort(1,MyPrice); 
    bShortTrailingStoped=1;
    bLongTrailingStoped=0;      Return; } If(HigherAfterEntry>=AvgEntryPrice+DayOpen*TrailingStart*0.01&&MarketPosition==1) {        StopLine=HigherAfterEntry-DayOpen*TrailingStop*0.01; }Else//止损 {        StopLine=UpperBand-DayOpen*StopLossSet*0.01; } If(Low<=StopLine) {        MyPrice=StopLine;        If(Open<MyPrice)MyPrice=Open;        Sell(1,MyPrice);
      bLongTrailingStoped=1;
      bShortTrailingStoped=0;        Return; } If(LowerAfterEntry<=AvgEntryPrice-DayOpen*TrailingStart*0.01&&MarketPosition==-1) {        StopLine=LowerAfterEntry+DayOpen*TrailingStop*0.01; }Else//止损 {        StopLine=LowerBand+DayOpen*StopLossSet*0.01; }
    If(High>=StopLine) {        MyPrice=StopLine;        If(Open>MyPrice)MyPrice=Open;        Buytocover(1,MyPrice);
    bShortTrailingStoped=1;
    bLongTrailingStoped=0;        Return; }

    //再次入场的代码 If(bLongTrailingStoped && MarketPosition==0 && High > HigherAfterEntry) {
    MyPrice = HigherAfterEntry + MinPoint;
    If(Open > MyPrice) MyPrice = Open;
    Buy(1,MyPrice);
    bLongTrailingStoped = 0;
    bShortTrailingStoped=1;
    Return; } If(bShortTrailingStoped && MarketPosition==0 && Low < LowerAfterEntry) {
    MyPrice = LowerAfterEntry - MinPoint;
    If(Open < MyPrice) MyPrice = Open;
    SellShort(1,MyPrice);
    bLongTrailingStoped = 1;
    bShortTrailingStoped= 0;
    Return; } End

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容