読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

注文は順番通りにされているのですか?

4件の返信

krzysiaczek99

購読者、bbp_participant、コミュニティ、68件の返信。.

プロフィールを表示

9年前 #116287

こんにちは、,

 

I’m designing plugin which plots number of open lots and I found out that the orders from SQOrderList are not sorted

 

According to some info from another plugins they suppose to be sorted

/**
	 * Function receives list of all orders sorted by open time and it could manipulate
	 * the list and remove any order that matches certain filter from the list.
	 *
	 * Order structure is available in the documentation here:
	 * http://www.strategyquant.com/doc/api/com/strategyquant/lib/results/SQOrder.html
	 *
	 * @param originalOrders - list of original orders that can be changed. Each order has the order properties specified above
	 */

but my code dedects this

package com.strategyquant.extend.TradeAnalysisPanes;

import org.jfree.chart.JFreeChart;
import com.strategyquant.lib.snippets.TradeAnalysisChartPane;
import com.strategyquant.lib.results.SQData;
import com.strategyquant.lib.language.L;
import com.strategyquant.lib.settings.SQConst;
import com.strategyquant.lib.results.SQOrderList;
import com.strategyquant.lib.results.SQOrder;
import com.strategyquant.lib.results.SQResultsGroup;
import com.strategyquant.lib.charts.common.SQLineChart;
import java.util.Date;

public class MaxNumberOfTrades extends TradeAnalysisChartPane {

	public MaxNumberOfTrades() {
		this.name = "MaxNumberOfTrades";
	}
	
   @Override
	public JFreeChart drawChart(SQResultsGroup strategyResult, SQData data) {
		SQLineChart chart = new SQLineChart();
      chart.xLegend = L.t("Trades");
      chart.yLegend = L.t("Lots");
           
      if(strategyResult==null) {
         return chart.render();
      }

     SQOrderList orderList = filterOrders(strategyResult, data);


     int lots = 0;
     long exittime = orderList.get(0).CloseTime;

     Date d = new Date(exittime);
     Date top = new Date(orderList.get(0).OpenTime);
     Date bottom = new Date(orderList.get(orderList.size()-1).OpenTime);
     
     System.out.println("Closetime "+d);
     System.out.println("Top "+top);
     System.out.println("Bottom "+bottom);


     for (int i = 0; i < orderList.size(); i++) {
      
       //System.out.println(orderList.get(i).OpenTime);
       //System.out.println(order.OpenTime);
       //System.out.println(order.CloseTime);
      
      if ( orderList.get(i).OpenTime <= exittime ) // exit time
      { lots++; }
      else
      { 
         lots = 0;
         exittime = orderList.get(i).CloseTime;
      }
           
      chart.add("", i+1, lots);
       
      }

		return chart.render();
	}
}

Closetime Mon Apr 04 10:12:00 GMT 2016
Top Thu Mar 31 23:08:00 GMT 2016
Bottom Fri Apr 01 00:01:00 GMT 2016

 

so orders are just upside down in comparison to trade file. In trade file there are orders with OpenPrice from 28.03 and 30.03 so 28.03 suppose to be at the bottom not 31.03

I’m enclosing trade file this I use for this test.

 

Can you give an example how to sort them ?

 

クリストフ

 

0

krzysiaczek99

購読者、bbp_participant、コミュニティ、68件の返信。.

プロフィールを表示

9年前 #141436

So what is the answer for this  ?? How many measures from QA showing wrong values because of this bug ?? When you are going to fix it ??? Hard to believe…this product is so many years around and still major bugs in….

 

クリストフ

0

マーク・フリック

管理者、sq-ultimate、2件の返信.

プロフィールを表示

9年前 #141501

こんにちは,

 

you are referring to a help comment from totally different category of snippets, it is not said that TradeAnalysis snipet uses ordered trades in any particular order, because order of trades does not influence most of these statistics.

 

But you you easily sort the orders by using command:

Collections.sort(orderList, new OrderComparatorByCloseTime());

 

you also have to add two imports to do that:

import java.util.Collections;
import com.strategyquant.lib.comparators.OrderComparatorByCloseTime;
 
You can altervatively sort orders by open time using OrderComparatorByOpenTime() or by ticket using OrderComparatorByOrder()

マーク
StrategyQuantアーキテクト

0

krzysiaczek99

購読者、bbp_participant、コミュニティ、68件の返信。.

プロフィールを表示

9年前 #141504

こんにちは、,

 

Thanks for the info. So after sorting trades will be in ascending or descending order ?? If descending how to flip this list upside down ??

意思  Collections.reverse(orderList) work ??

 

クリストフ

0

マーク・フリック

管理者、sq-ultimate、2件の返信.

プロフィールを表示

9年前 #141516

it is in natural order. Collections.reverse() should work.

マーク
StrategyQuantアーキテクト

0

4件の返信を表示中 - 1 - 4件目 (全4件中)